Simple question

Hi all, happy new year

why extending a database component in proto.ui I can’t put the columns prototype?

check this { keepViews: true, cells: [, { id: "page2", view: "tpl1", data: page2, columns: webix.copy(tpl1cols) }, { id: "page4", view: "tpl1", data: page4, columns: webix.copy(tpl1cols) }, { id: "page5", view: "tpl1", data: page5, columns: webix.copy(tpl1cols) }] }

I had to create a columns variable and then I had to explicitly copy columns for three identical datatable component

Thank you

Hi,

You can put the columns into the prototype via the $init handler, but using webix.copy is still required as Webix code processes the columns content:

webix.protoUI({ 
  name:"tpl1",
  $init:function(config){
    var tpl1cols = [ 
      	{ id:"title", header:"<b>Title</b>", fillspace:true,  sort:"string" },
    	{ id:"year", header:"<b>Year<b>", width:100, sort:"int" },
    	{ id:"votes", header:"<b>Votes</b>", width:100, sort:"int" }   
    ];
   config.columns = webix.copy(tpl1cols); 
  }
}, webix.ui.datatable);

Check, please: http://webix.com/snippet/9af8fb67

Very well.

Changed my code and works fine. Thank you Helga.