KoGrid icon indicating copy to clipboard operation
KoGrid copied to clipboard

Selected Row Not Updated When kgGrid.SelectedItems Changed

Open skyscaler opened this issue 11 years ago • 5 comments

I'm trying to select & highlight a newly added item to koGrid.data. After adding the new item to the ko.observableArray data-bind to kgGrid.SelectedItems from view model, the previous selected row remains highlighted, whereas the newly added item is not highlighted even if it has become the "active" selected object.

Could you please check if there's a css update event which can be triggered by SelectedItems changes.

Thanks a lot!

skyscaler avatar Mar 04 '13 07:03 skyscaler

skyscaler - > when you push an new item to the koGrid data collection your previous selected items are still selected ? because every time I push a new item to grid collection my selected items are lost .

rzvpopescu avatar Mar 04 '13 13:03 rzvpopescu

run2esc ->In my case, the previous selected items are lost, but they remain highlighted, until a mouse click triggers a toggleSelection; whereas the newly items are "selected", but not highlighted. So I suspect SelectedItems change event doesn't trigger css update properly.

When you selected items are lost, they remain highlighted (css: .kgRow.selected)?

skyscaler avatar Mar 04 '13 14:03 skyscaler

I think is a problem with selected items when adding/updating items from grid . Is this a known issue.problem >? Is there a workaround ?

rzvpopescu avatar Mar 04 '13 15:03 rzvpopescu

I'm wanting to do the same thing (change the selection by removing and adding to the selectedItems observable array). Here's a demo where it's not working for me: http://plnkr.co/edit/hVjzwPaUVNm6mIVEEeA6

aligneddev avatar Mar 05 '13 20:03 aligneddev

Here's a hacked up version of your demo that works. It appears that the grid doesn't listen to the viewModel probably because it doesn't have an "Update" in it's binding handler. Also, the rowindex is 1 based for the rowFactory's rowCache.

http://plnkr.co/edit/f65ertoYJSH1xJiTiNie?p=preview

charlieknoll avatar Mar 08 '13 01:03 charlieknoll