EasyUI Forum
May 21, 2024, 06:25:33 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: Show/Hide row in datagrid without reload datas  (Read 7262 times)
Fabrice
Jr. Member
**
Posts: 62


View Profile
« 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?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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();
        })
    }
})
Logged
Fabrice
Jr. Member
**
Posts: 62


View Profile
« Reply #2 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 ?
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!