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
Post a Comment