Categories | Question details Back To List | ||
dhtmlxgrid: align and round Hi there, I am trying to configure a dhtmlxtreegrid to get cell values rounded (precision: 2) and content aligned but both methods (conf through XML or from JS) does not seem to work. Maybe I missed something. Here is the code: JS (there are more than 60 colums): mygrid = new dhtmlXGridObject('gridbox'); mygrid.imgURL = "/images/dhtmlxgrid/icons_greenfolders/"; mygrid.setHeader("Project/Consultant,January,#cspan,#cspan,#cspan,#cspan,February,#cspan,#cspan,#cspan,#cspan,March,#cspan,#cspan,#cspan,#cspan,April,#cspan,#cspan,#cspan,#cspan,May,#cspan,#cspan,#cspan,#cspan,June,#cspan,#cspan,#cspan,#cspan,July,#cspan,#cspan,#cspan,#cspan,August,#cspan,#cspan,#cspan,#cspan,September,#cspan,#cspan,#cspan,#cspan,October,#cspan,#cspan,#cspan,#cspan,November,#cspan,#cspan,#cspan,#cspan,December,#cspan,#cspan,#cspan,#cspan"); mygrid.attachHeader("#rspan,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€,DP,DR,TP,TR,DR€"); mygrid.setInitWidths("200,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50"); mygrid.setColAlign("left,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center,center"); mygrid.setColTypes("ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,ed"); mygrid.enableLightMouseNavigation(true); mygrid.enableRowsHover(true,'grid_hover') //mygrid.setColumnColor("white,white,#e1ecf7,white,#e1ecf7,white"); mygrid.init(); mygrid.splitAt(1); mygrid.setSkin("light") // mygrid.enableSmartXMLParsing(true); mygrid.setMathRound(2); mygrid.loadXML("/monitoring/projects"); In XML I tried things like: <cell align="center">0</cell> Any hekp will be appreciated. Thanks, Fabrice. Answer posted by Support on Jan 16, 2008 07:57 >>mygrid.setMathRound(2); This command work only for result of math calculation, if you just want to format loaded data, you can change column type to ""edn" and use setNumberFormat command mygrid.setColTypes("edn, mygrid.init(); mygrid.setNumberFormat('0.00',0) //second parameter - index of column, for which format applied. The align setting in your code snippet is correct , the same code works fine for me, if necessary you can define align for separate cells as <cell style='text-align:left'>0</cell> Answer posted by fabrice.clari@zaltana.fr on Jan 16, 2008 09:40 Thanks - it worked. Fabrice. |