selection is dropped from synced datacollections when data is updated

edited April 2018 in Technical questions

This is quite annoying bug/feature:

When two datatables are synced and user selects item in the slave datatable. If meanwhile data in the master is being updated selection in the slave is dropped. Here is the code example:

This happens even if we sync datatables with non-ui datacollection:

Is there any workaround for this?

Thank you in advance!


  • Hello @Ingvord ,
    It's not a bug. setCursor method is supported only by collections. More information about it is here
    In visible components, such method is useless, cause it's the same as select
    Ultimately, binding depends on the select of the visible components and the position of the cursor in the collections

  • Hello @Nastja ,

    Thanks for the quick response.

    Sorry, it seems provided code examples are misleading - setCursor has nothign to do with the issue. My scenario is the following: user clicks on a datatable that is synced with another one. The row is highlighted - OK. But then if the master data is updated, via parse, for instance. The selection in the datatable disappears.

    I have updated the code snippet:

    If you remove the last line, selection is there, as expected.

    So the question is - is there a workaround to preserve selection in the slave component?

  • edited April 2018

    Select is applied to a data item with a specific ID. When the data is updated, all data in the datatable is completely updated - the select should be reset in this case.

    For example, if you use bind you can select row via onBindApply event

      if (this.getFirstId());              

    And Webix datatable provides a possibility to store/restore the state of the grid
    For example to save the current datatable state to the local storage you should call the getState method as in:

    var state = grid.getState();"state", state);

    So you can save in the browser local store some parameters and restore them after the reboot
    More information is here

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!