代码之家  ›  专栏  ›  技术社区  ›  Tamer

使用dxTreeList在页面加载时显示所选节点

  •  0
  • Tamer  · 技术社区  · 6 年前

    我正在使用devextreme dxTreeList和knockout js

    here is my exmple in codepen 我的问题是: 如何将json数据从web服务分配给 selectedRowKeys 我的数据如下

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

    数据如下

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

    我希望数据是这样的

    GetData ([2,8,25])
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Ray    6 年前
    var stringArray = data[0].split(",");
    stringArray.forEach(function(string){
        selectedRowKeys.push(parseInt(string));
    });
    self.GetData(selectedRowKeys);