Possible to update datamap with new data?

Posted by: ryansoftwareengineer on 3 March 2021, 5:53 pm EST

    • Post Options:
    • Link

    Posted 3 March 2021, 5:53 pm EST

    I have this code

    some class constructor…

    this.ObservableArray = new wijmo.collections.ObservableArray();

    this.DataMap = new wijmo.grid.DataMap(this.ObservableArray);

    I have a column in a flexgrid that has a drop down from this data map.

    At some point the observable array might be updated from an ajax call.

    I want to update the drop down in the flexgrid column

  • Posted 4 March 2021, 2:38 am EST

    Hi,

    If you need the DataMap to update automatically, then instead of storing simple string values in ObservableArray, you need to store them as Object and pass selectedValue and display path to the DataMap constructor. Please refer to the following code snippet and the sample demonstrating the same:

    var observableArr = new wjCore.ObservableArray(
      "US,Germany,UK,Japan,Italy,Greece".split(",").map((item) => ({ value: item }))
    );
    
    var countryCol = grid.columns.getColumn("country");
    countryCol.dataMap = new wjGrid.DataMap(observableArr, "value", "value");
    

    https://codesandbox.io/s/wijmo-starter-forked-86k6j?file=/src/index.js

    Regards

  • Posted 4 March 2021, 5:35 pm EST

    o snap that was easy

    thanks so much

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels