EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: korenanzo on February 23, 2016, 02:46:56 AM



Title: combogrid: hiding rows
Post by: korenanzo on February 23, 2016, 02:46:56 AM
Hi,

I have a combo grid loaded with local data.

is it possible to hide the rows that not match with the typed text?

Thanks, RIc


Title: Re: combogrid: hiding rows
Post by: stworthy on February 23, 2016, 07:40:01 AM
Please try to enable filter on the drop-down datagrid. The 'enableFilter' method is extended from http://www.jeasyui.com/extension/datagrid_filter.php
Code:
$('#cc').combogrid({
//...
}).combogrid('grid').datagrid('enableFilter');


Title: Re: combogrid: hiding rows
Post by: korenanzo on February 23, 2016, 08:11:12 AM
ok,

but I am not sure how to bind the textfield with the filter

for example,
Code:
$('#cc').combogrid({
        delay: 500,
        mode: 'local',
        hasDownArrow: false,
        value: valore,
        idField: 'tb_testo',
        textField: 'tb_testo',

        columns: [[
            {
                field: 'tb_cod',
                title: 'Cod',
            },
            {
                field: 'tb_desc',
                title: 'Desc',
                width: 200
             },
       
            {
                field: 'tb_testo',
                title: 'test',
                hidden: true
            }
    ]],
        data: dati
     

    }).combogrid('grid').datagrid('enableFilter',[{
        field:'tb_desc',
       op:'contains',
       value: ?????
    }]);


what do I must put as value ?

How can I write a filter  if I need to match the text against with more than one column (for example I'd like to check if the typed word is contained in tb_desc OR in tb_testo column)?

thanks,
RIc





Title: Re: combogrid: hiding rows
Post by: stworthy on February 24, 2016, 12:52:19 AM
You will have to override the keyHandler.query function to add filter rules according to the typed string.
Please try this example http://jsfiddle.net/xy5nbw2k/2/