javascript - SlickGrid onSelectedRowsChanged not firing -
i have following issue slickgrid:
- left click row 1 (onselectedrowschanged fires expected)
- hold down control button
- left click row 2 (onselectedrowschanged fires expected)
- left click row 1 (onselectedrowschanged fires expected)
- let go of control button
- click row 1 (onselectedrowschanged not fire! if click on same row 1 cell before)
issues described on step 6 above. here link jsfiddler showing issues: http://jsfiddle.net/fortesl/olj8otsj/1/
code attached:
var grid; var data = []; var columns = [{ id: "title", name: "title", field: "title", width: 300, selectable: false, resizable: false }, { id: "priority", name: "priority", field: "priority", width: 200, selectable: false, resizable: false }]; var options = { editable: true, enableaddrow: true, enablecellnavigation: true, forcefitcolumns: true, autoedit: false }; (var = 0; < 100; i++) { var d = (data[i] = {}); d["title"] = "task " + (i + 1); d["priority"] = "medium"; } grid = new slick.grid("#mygrid", data, columns, options); grid.setselectionmodel(new slick.rowselectionmodel()); grid.onselectedrowschanged.subscribe(function () { var selectedrows = grid.getselectedrows(); (var = 0; < selectedrows.length; i++) { selectedrows[i] = selectedrows[i] + 1; } $('.selected-rows')[0].innerhtml = selectedrows; }); grid.onclick.subscribe(function () { $('.selected-rows')[0].innerhtml = ''; });
please help
i solved issue handling onclick event , calling setselectedrows handler. shown below:
grid.onclick.subscribe(function(e) { var cell = $scope.grid.getcellfromevent(e); var row = (cell) ? cell.row : 0; var rows = [row]; grid.setselectedrows(rows); });
Comments
Post a Comment