display selected nodes on page load using dxTreeList

591 views Asked by At

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])
1

There are 1 answers

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