EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Jakob on April 04, 2013, 04:30:43 AM



Title: Jquery EasyUI combogrid selected value
Post by: Jakob on April 04, 2013, 04:30:43 AM
I have the following Combogrid for autocomplete drop down

Code:
$('#product').combogrid({  
    panelWidth:500, 
    url: 'myservice', 
    idField:'prodId', 
    textField:'desc', 
    mode:'remote', 
    fitColumns:true, 
    columns: [[ 
                {field:'prodId',title:'Product No',width:10}, 
                {field:'desc',title:'Desc',width:75}
            ]]
});
When user selects a value from drop down, I would like to set the description of the selected product to another input field.

How can I do this?


Title: Re: Jquery EasyUI combogrid selected value
Post by: stworthy on April 04, 2013, 05:23:54 AM
When select a row from drop-down panel, the 'onSelect' event is fired, in which you can get the selected row and assign the description field value to other input.
Code:
$('#product').combogrid({  
    panelWidth:500, 
    url: 'myservice', 
    idField:'prodId', 
    textField:'desc', 
    mode:'remote', 
    fitColumns:true, 
    columns: [[ 
                {field:'prodId',title:'Product No',width:10}, 
                {field:'desc',title:'Desc',width:75}
            ]],
onSelect: function(index,row){
var desc = row.desc;  // the product's description
console.log(desc);
}
});


Title: Re: Jquery EasyUI combogrid selected value
Post by: Jakob on April 04, 2013, 10:24:43 AM
Thanks, this has solved my problem.

I have another question, is is possible to bring results when minimum characters are typed, e.g. if 4 characters are typed then bring out the results rather than for each key stroke.

Regards