EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Fabrice on September 02, 2014, 10:12:59 AM



Title: Show/Hide row in datagrid without reload datas
Post by: Fabrice on September 02, 2014, 10:12:59 AM
I want to show/hide somes rows in a datagrid without use filterRow, the best way will be a method like dg.datagrid('hideRow',rowIndex) and dg.datagrid('showRow',rowIndex)
how can i do that?


Title: Re: Show/Hide row in datagrid without reload datas
Post by: stworthy on September 02, 2014, 06:16:00 PM
It is easy to extend these two methods.
Code:
$.extend($.fn.datagrid.methods,{
    showRow: function(jq, index){
        return jq.each(function(){
            var opts = $(this).datagrid('options');
            opts.finder.getTr(this, index).show();
        })
    },
    hideRow: function(jq, index){
        return jq.each(function(){
            var opts = $(this).datagrid('options');
            opts.finder.getTr(this, index).hide();
        })
    }
})


Title: Re: Show/Hide row in datagrid without reload datas
Post by: Fabrice on September 03, 2014, 02:56:38 AM
I try this but i have a large number of rows and this method is slow,
I think it will be better to have a visibility property, then in my enumeration of rows, i can check row visibility and call show/hide only when it's necessary?

Another question: i have a slider and when value of slider change, i would like to color rows with value lower this value, i use rowStyle to do that, with 'loaddata' it work's fine but when i change slider, i don't want to call 'loaddata' but method 'resize' or 'reload', function rowStyler is not called with these two methods, what method must i call ?