EasyUI Forum
September 15, 2025, 02:38:07 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Datagrid FilterRow defaults combobox for 0  (Read 6935 times)
tofix
Newbie
*
Posts: 4


View Profile
« on: September 12, 2016, 04:44:00 AM »

Hi,

however the combobox uses a data entry with value 0 (as number) as default.
How this can be disabled?

http://jsfiddle.net/xxxe1p79/

With line 31 with 0 as string the combo text of status filter will stay empty by default:
data:[{value:"0",text:'All'},{value:'P',text:'P'},{value:'N',text:'N'}],

With line 31 with 0 as number, the combo shows "All" as default:
data:[{value:0,text:'All'},{value:'P',text:'P'},{value:'N',text:'N'}],

How can I set data with a value of 0 as number while having the combo text empty as default without defining the number as string?

Thanks!
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 on: September 12, 2016, 06:56:50 AM »

You can define a 'loadFilter' function to convert the 0 value to '0' string.
Code:
loadFilter:function(data){
    return $.map(data, function(item){
        if (item.value == 0){
            item.value = '0';
        }
        return item;
    })
}

Or clear the inputing box when loaded data successfully.
Code:
onLoadSuccess:function(){
    $(this).combobox('setText', '')
}
Logged
tofix
Newbie
*
Posts: 4


View Profile
« Reply #2 on: September 13, 2016, 05:38:13 AM »

Thanks jarry, because setText will kepp the item selected, i will use the first version.
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!