Sync filtering in Combo

edited September 2015 in Technical questions

It looks like a bug. Sync filtering doesn't work in Combo.

I've had an example.

var data = [{id: 1, value: "Record 1"},
    {id: 2, value: "Record 2"},
    {id: 3, value: "Record 3"},
    {id: 4, value: "Record 4"}];

webix.ui({
    rows: [{
        view: "combo",
        id: "combo",
        label: "Combo",
        options: []
    }, {
        view: "list",
        id: "list",
        label: "List",
        options: []
    }, {}]
});

var store = new webix.DataStore();

// OK. Only 2 records
$$("list").sync(store, function () {
    this.filter(function (data) {
        return data.id > 2;
    })
});

// Error. 4 records
$$("combo").getPopup().getList().sync(store, function () {
    this.filter(function (data) {
        return data.id > 2;
    })
});

store.importData(data);

My workaround looks like that. One more DataStore.

var comboStore = new webix.DataStore();
comboStore.sync(store, function() {
    this.filter(function (data) {
        return data.id > 2;
    })
});

$$("combo").getPopup().getList().sync(comboStore);
Tagged:

Comments

  • I can confirm this behavior. Filtering in the combo will reset filtering that was applied during data sync.

    Unfortunately there is no easy way to resolve the issue. I will add it to the TODO list, so some solution will be added in next updates ( not in 3.0 for sure )

  • Three years passed, but unfortunately this bug is still here.

    xpoft, thanx for your workaround recipe.

  • nothing new about this bug?

  • edited January 18

    Hello,

    Unfortunately, the issue has not been fixed as there cannot be any simple solution for it.

    If you do not need synchronizing data (I mean refrecting add/update/remove modifications in the Combo dropdown) and you only need to pass the initial data, you can use list.importData(data).

    We will put the issue into our backlog and investigate into the possible solution.

Sign In or Register to comment.