Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ravi on Feb 05, 2009 02:25
open dhtmlx forum
How can I attach dhtmlxToolBar to grid header

I need to attach dhtmlxToolbar to dhtmlxGrid header..I m using attachToObj but its giving error as obj.appendChild is not a function.Its need to be done urgently.Please do provide solution
Below is my code:
var backlog_grid=null;
function backlogResponse(loader)
{ dhxWins.window("w1").setDimension(1000, 435);
if(loader.xmlDoc.responseText!= null)
            {    
         
                if(tab&&document.getElementById('tab_backLog_contents').style.display=="none")
                {
                 tab.addTab("a2","BackLog Summary","150px");    
                 tab.enableAutoSize(false,true);
                }
                document.getElementById('tab_backLog_contents').style.display="block";    
                document.getElementById('toolbarObj').style.display="block";
                tab.setSkin("light") ;
                tab.showTab("a2");
                tab.setTabActive("a2");
                tab.setContent("a2","tab_backLog_contents");    
                var webBar = new dhtmlXToolbarObject("toolbarObj");
     webBar.setIconsPath("/TSTVMZ/dhtmlxToolbar/images/");
             backlog_grid= new dhtmlXGridObject("tab_backLog_contents");
                backlog_grid.setImagePath(uri+'dhtmlxGrid/codebase/imgs/icons_greenfolders/');
                backlog_grid.setHeader(",,,,,,,") ;
                backlog_grid.setInitWidths("70,70,150,100,80,80,80,80,80,80,*");
                backlog_grid.setColAlign("center,center,left,left,right,right,right,right,right,center,center");
                backlog_grid.setColTypes("ro,ro,ro,ro,ro,link,link,link,link,link,link");
                backlog_grid.setSkin("light");                
                backlog_grid.enableAutoHeight(true);
                backlog_grid.enableSmartRendering(true,50);
                backlog_grid.setColSorting("str,int,str,str,int,int,int,int,int,int,str");
                backlog_grid.init();
                backlog_grid.attachToObject(webBar);
                backlog_grid.loadXMLString(loader.xmlDoc.responseText);    
                var grantTotalBk = backlog_grid.getUserData("0","grantTotalBk");
var grantBkAmt = backlog_grid.getUserData("0","grantBkAmt");
                var grantBackAmt = backlog_grid.getUserData("0","grantBackAmt");
                var grantRevenue = backlog_grid.getUserData("0","grantrevenue");
                var grantTmDelta = backlog_grid.getUserData("0","grantTmDelta");                
                //var footerData = "Grand Total,#cspan,#cspan,#cspan,"+'1827964.00'+"\",#cspan";
                //alert(footerData);
                //backlog_grid.attachFooter(footerData);
                dhxWins.window("w1").progressOff();
                tab.enableAutoReSize(false) ;                
            }
             tab.setOnSelectHandler(onSelectTab);
}
Answer posted by Support on Feb 05, 2009 07:32
attachToObject method of grid can be used to attach grid to some HTML container on the page, it can't be used for linking grid and toolbar. 
You can change your code as 

 backlog_grid.setHeader("<div id="toolbarObj"></div>,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan") ; 
... grid init code
backlog_grid.init(); 
var webBar = new dhtmlXToolbarObject("toolbarObj"); 
... toolbar init code