javascript - SlickGrid Unselect Row CheckBox Event -


i new jquery, , need use grid in project. chose slickgrid (quite slick indeed). need disable buttons when rows deselected.

i using following callback:

grid.onselectedrowschanged.subscribe(function(){}); 

the problem callback executed on selection - not when rows deselected.

grid.onselectedrowschanged.subscribe(function(){      var selectedrows = grid.getselectedrows();      if (selectedrows.length === 0) {           // (when rows deselected)           // logic goes here...      } }); 

if want execute logic on row deselect suggest storing selectedrows in global variable updated on selectedrowschanged event. in onselectedrowschanged compare global selectedrows variable , grid.getselectedrows() lenghts see if changes have occured.

var lastselectedrows = [];     grid.onselectedrowschanged.subscribe(function(){      var selectedrows = grid.getselectedrows();      if (selectedrows.length < lastselectedrows.length ) {         // proceed in finding actual row comparing 2 arrays         // rest of logic goes here...       }       lastselectedrows =  selectedrows;  }); 

!note i'm new in world of slickgrid , may not best solution. think it's worth try.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -