Create multiple datatables dynamically

I want to create multiple datatables in an efficient way rather than hardcoding the columns.
I am new to webix, Is there a way to do it?


  • edited June 2017


    Firstly, Webix Datatable can create its columns automatically based on the loaded data:

    { view:"datatable", autoConfig:true, data:grid_data /*or remote url*/}

    Secondly, you can provide one and the same columns array for multiple datatables by copying it:

    var columns = []; //some hard-coded values
        {view:"datatable", columns:webix.copy(columns)},
        {view:"datatable", columns:webix.copy(columns)}

    Please, check the related snippet:

  • Can I somehow use javascript prototypes in this case?

  • or may be jquery to create all these elements dynamically?

  • The config is a normal js object, so you can use a common for loop or any other js logic to build the UI config. There is no need to use jQuery for such a task.

  • Hey maksim, Can you give an example as I am new to JS too.

  • @amrutahanchate, please check the following snippet:

  • Hi Helga, I want to create a hashmap associated with every datatable so that i can keep a track of its key and value. Can you please suggest a way to do it?

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!