EasyUI Forum

General Category => General Discussion => Topic started by: azizkhani on April 17, 2015, 01:31:01 AM



Title: how to select first item in combobox after load data
Post by: azizkhani on April 17, 2015, 01:31:01 AM
how to select first item in combobox after load data  in all combobox
 ??? ??? ??? ???


Title: Re: how to select first item in combobox after load data
Post by: jarry on April 25, 2015, 04:39:29 PM
Call the 'select' method to select the first item when loaded data successfully, you can override the $.fn.combobox.defaults.onLoadSuccess to achieve this functionality.
Code:
<script>
$.fn.combobox.defaults.onLoadSuccess = function(items){
if (items.length){
var opts = $(this).combobox('options');
$(this).combobox('select', items[0][opts.valueField]);
}
}
</script>


Title: Re: how to select first item in combobox after load data
Post by: azizkhani on April 26, 2015, 09:05:21 AM
thanks a lot