-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Description
Hi, I've a bug with a multiselect: true and enableSorting: true koGrid.
For example: if the grid have multiple rows, I select one and than I order by a column, it seems that the selectedItems array lost the row.
I think that the problem is on the selectionService.js,
self.setSelection = function(rowItem, isSelected) {
rowItem.selected(isSelected) ;
rowItem.entity[SELECTED_PROP] = isSelected;
if (!isSelected) {
var indx = self.selectedItems.indexOf(rowItem.entity);
self.selectedItems.splice(indx, 1);
} else {
if (self.selectedItems.indexOf(rowItem.entity) === -1) {
self.selectedItems.push(rowItem.entity);
}
}
};
should be:
self.setSelection = function(rowItem, isSelected) {
rowItem.selected(isSelected) ;
rowItem.entity[SELECTED_PROP] = isSelected;
if (!isSelected) {
var indx = self.selectedItems.indexOf(rowItem.entity);
if (indx === -1) {
return;
}
self.selectedItems.splice(indx, 1);
} else {
if (self.selectedItems.indexOf(rowItem.entity) === -1) {
self.selectedItems.push(rowItem.entity);
}
}
};
Metadata
Metadata
Assignees
Labels
No labels