KoGrid icon indicating copy to clipboard operation
KoGrid copied to clipboard

Lost selected items on filter

Open angelogulisano opened this issue 8 years ago • 0 comments

Hi, I'm using KoGrid 2.1.1 , with knockout-3.4.1. I declared 2 observable arrays in my model:

self.Siti = ko.observableArray([]);
self.SitiSelezionati= ko.observableArray([]);

I popolated "Sites" with "complex" object:

function sitoObject(_id, _titolo, _url, _gruppoReader) {
    var self = this;
    self.Id = ko.observable(_id);
    self.Titolo = ko.observable(_titolo);
    self.Url = ko.observable(_url);
    self.GruppoReader = ko.observable(_gruppoReader);
}

I declared KoGrid:

 <div class="gridStyle" data-bind="koGrid: {
                                                                                **data: Siti,**
                                                                                primaryKey: 'Id',
                                                                                showFilter: true,
                                                                                enableSorting: true,
                                                                                multiSelect: true,
                                                                                paging: true,
                                                                                selectWithCheckboxOnly: false,
                                                                                **selectedItems: SitiSelezionati,**
                                                                                footerVisible: false,
                                                                                displaySelectionCheckbox: true,
                                                                                columnDefs: [{
                                                                                    field: 'Titolo', displayName: 'Sito'
                                                                                }]
                                                                            }">
                                                </div>

The items are correctly loaded, If I click an item the grid put it in "SitiSelezionati" array, but when I apply the filter on the grid, I loose previous selected item.

What am I doing wrong?

thanks for support!

angelogulisano avatar Feb 18 '17 10:02 angelogulisano