Hi,
It would be nice if the iggrid extension exposes an observable array of selected rows (items).
We've started to create an implementation to do this, although it would be better if it could be included in the standard iggrid-knockout-extension.
ko.bindingHandlers.igGridSelection = { init: function (element, valueAccessor, allBindingsAccessor, viewModel) { var selectedRowsArray = valueAccessor(); // By ref ? var dataSource = allBindingsAccessor().igGrid.dataSource; $(element).bind('iggridselectionrowselectionchanged', function (evt, ui) { selectedRowsArray.removeAll(); var rows = ui.selectedRows; for (var i = 0; i < rows.length; i++) { var index = rows[i].index; selectedRowsArray.push(dataSource()[index]); } }); $(element).bind('iggridsortingcolumnsorting', function (evt, ui) { selectedRowsArray.removeAll(); }); } };Currently the 'iggridselectionrowselectionchanged' event is only raised when adding rows to the selected rows list.We've opened a discussion on this forum to have the event also raised when deselecting, this would make it much easier to implement the selected rows in the knockout extension. Greetings,Christophe
Have you guys figured the bindings out for a KO observable of selected rows? The code would be really helpful to me right now. Thanks.