EasyUI Forum
April 29, 2024, 05:48:40 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to select first item in combobox after load data  (Read 15115 times)
azizkhani
Newbie
*
Posts: 37


View Profile Email
« on: April 17, 2015, 01:31:01 AM »

how to select first item in combobox after load data  in all combobox
 Huh Huh Huh Huh
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 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>
Logged
azizkhani
Newbie
*
Posts: 37


View Profile Email
« Reply #2 on: April 26, 2015, 09:05:21 AM »

thanks a lot
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!