Skip to content

Lost selected items on filter #314

Description

@angelogulisano

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions