Search code examples
javascriptjsonknockout.jsdevextremetreelistview

display selected nodes on page load using dxTreeList


I am using devextreme dxTreeList and knockout js

here is my exmple in codepen my questions is : how to assign json data from web service to the selectedRowKeys my data is like

 $.getJSON('../DataAPI/api/Data/GetData', function (data) {
            self.GetData(JSON.parse(data));})

and the data comes like this

GetData (["2,8,25"])

I want the data comes like this

GetData ([2,8,25])

Solution

  • var stringArray = data[0].split(",");
    stringArray.forEach(function(string){
        selectedRowKeys.push(parseInt(string));
    });
    self.GetData(selectedRowKeys);