EasyUI Forum
April 19, 2024, 12:30:38 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: Combobx issue: default item selection when itemValue = 0  (Read 2718 times)
gordis gmbh
Full Member
***
Posts: 103


View Profile Email
« on: November 20, 2018, 11:37:35 PM »

Hello,

I have set up a combobox with static data. The first item, which has 0 as value, is automatically selected.

 
  •   Why is this element by default selected?
  • How can I avoid this behavior?


For more details please have a look at this example http://jsfiddle.net/2491fkha/
 
Thanks.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: November 21, 2018, 07:12:18 AM »

Please set the 'value' with a non empty value such as -1, or try to put this code to the page to fix this issue.
Code:
<script>
$.extend($.easyui, {
indexOfArray: function(a, o, id){
for(var i=0,len=a.length; i<len; i++){
if (id == undefined){
if (a[i] == o){return i;}
} else {
if (String(a[i][o]) == String(id)){return i;}
}
}
return -1;
}

})
</script>
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!