Datatable don't read data from jsarray

I started using WEBIX and tried to use jsarray, with the component datatable.
When using jsarray format, it's not possible to update the data on the datatable.
Only the first data is show.
Look this sample please:

var array1 = [ [1,"Filipe","Oporto"],[2,"David","NY"],[3,"Marie","Paris"] ];
var array2 = [ [4,"John","London"],[5,"Joana","Lisbon"],[6,"Pablo","Madrid"],[7,"Peter","LA"] ];

webix.ui({
    view:"button", 
    label:"test new data", 
    click: function() {
        new_data() 
    }
});

webix.ui({
    view:"datatable",
    id: "mytable",
    columns:[
        {id:"data0", header:"ID" },
        {id:"data1", header:"Name" },
        {id:"data2", header:"City" }    
    ],                                      
    datatype: "jsarray",                
    data: array1
});

function new_data () {

    var mytable = $$("mytable");
    mytable.parse(array2);
}

When button is pressed, 4 new empty lines appear in the table, without data.

Tagged:

Comments

  • You need to specify a format of a data in the parse command

    mytable.parse(array2, "jsarray");
    

    By default, component will expect the json data.

  • That's it!! Thank you.

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!