reduce add tabbar function

Hi,

I don’t know how to add the function into there (var dhxGrid = tabbar.cells(“array_num[i]”).attachGrid():wink:

thank you.

function tabbar_array(){
var array_num = new Array();
array_num[0] = “a1”;
array_num[1] = “a2”;
array_num[2] = “a3”;
array_num[3] = “b1”;
array_num[4] = “b2”;
array_num[5] = “b3”;
}

tabbar = dhxLayout.cells(“b”).attachTabbar();
tabbar.setImagePath(“dht/tabbar/codebase/imgs/”);
tabbar.setSkin(“dhx_skyblue”);
tabbar.addTab(“a1”,“Aug 21 - Sep 20”,“130px”);
tabbar.addTab(“a2”,“Sep 21 - Oct 20”,“130px”);
tabbar.addTab(“a3”,“Oct 21 - Nov 20”,“130px”);
tabbar.addTab(“b1”,“Nov 21 - Dec 20”,“130px”);
tabbar.addTab(“b2”,“Dec 21 - Jan 20”,“130px”);
tabbar.setTabActive(“a1”);

for(var i = 0; i <= 5; i++){
            tabbar_array();
	var dhxGrid = tabbar.cells("[b]array_num[i][/b]").attachGrid();
    dhxGrid.setImagePath("dht/grid/codebase/imgs/");
	dhxGrid.setSkin("dhx_skyblue");
	dhxGrid.loadXML("lib/get_away_from_office.php");
	var dp = new dataProcessor("away_from_office_connector.php");
	dp.init(dhxGrid);
	dhxGrid.attachFooter("<center><input type='button' name='add' id='add' value='add row' onclick='add_row()'>&nbsp;&nbsp;&nbsp;<input type='button' name='delete' id='delete' value='delete row' onclick='dhxGrid.deleteSelectedRows()'></center>,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan");

}

Hi
I corrected your code a little. Look red & green marks.

//you can delete function tabbar_array() at all
tabbar = dhxLayout.cells(“b”).attachTabbar();
tabbar.setImagePath(“dht/tabbar/codebase/imgs/”);
tabbar.setSkin(“dhx_skyblue”);
tabbar.addTab(“a1”,“Aug 21 - Sep 20”,“130px”);
tabbar.addTab(“a2”,“Sep 21 - Oct 20”,“130px”);
tabbar.addTab(“a3”,“Oct 21 - Nov 20”,“130px”);
tabbar.addTab(“b1”,“Nov 21 - Dec 20”,“130px”);
tabbar.addTab(“b2”,“Dec 21 - Jan 20”,“130px”);
tabbar.setTabActive(“a1”);

array_num = [“a1”,“a2”,“a3”,“b1”,“b2”,“b3”]; //but as i see you haven’t such tas like “b3”
for(var i = 0; i <= 5; i++){
//line here was deleted
var dhxGrid = tabbar.cells(array_num[i]).attachGrid(); //you don’t need quotes here
dhxGrid.setImagePath(“dht/grid/codebase/imgs/”);
dhxGrid.setSkin(“dhx_skyblue”);
dhxGrid.loadXML(“lib/get_away_from_office.php”, function(){
dhxGrid.attachFooter("   ,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan");
}); //the best way to attach footer is call it after XML loading
var dp = new dataProcessor(“away_from_office_connector.php”);
dp.init(dhxGrid);

}

Hi,

Thank you for your reply, it can not display the buttons and no footer.

thanks.

If you use the PRO Edition and you have active support subscribtion, please create a ticket in the online support system and attach comoleted demo there.
If no - attach completed demo here:
docs.dhtmlx.com/doku.php?id=othe … leted_demo