Categories | Question details Back To List | ||
setRowTextBold after loading XML data Hello, I'm loading the data in a grid through an XML file. I'd like to set some rows in bold from the XML file, but it doesn't work. I tried this in the XML file: −<?xml version="1.0" encoding="UTF-8"?> <rows> <head><afterInit><call command="setRowTextBold"><param>1</param></call></afterInit></head> <row id="1"> <userdata name="tip_0">Play</userdata> <cell>...</cell> <userdata name="tip_1">Published on December 12 2007 at 6:30pm</userdata> <cell>...</cell> </row> [...] </rows> I tried to put the head after and before all rows, afterInit and beforeInit,I still don't have any row in bold. I'm using the 1.5 version. Thank you Answer posted by Stanislav on Dec 24, 2007 19:18 Actually the XML which you provide must work correctly ( and it do so in my case ) Alternatively you can use <row id="1" style="font-weight:bold">... Answer posted by Julien Sobrier on Dec 24, 2007 20:37 Thank you, changing the style works. What does the function setRowTextBold do exactly; does it also change the css style of the row? I need to call setRowTextBold and setRowTextNormal on rows after loading the data as well. I'd like to understand why afterInit does not work. I have a page with several tabs, all in Ajax. The grid is in one of the tabs,not in the active one. The grid seems to load the data when I click on the the tab that contains the grid. So I wonder if the issue is that afterInit is loaded after the initialization of the grid, not after the data are loaded. Thank you Answer posted by Stanislav on Dec 25, 2007 17:18 >>What does the function setRowTextBold do exactly; does it also change the css style of the row Function change font-weight css style of cells in necessary rows, setRowTextNormal restore it to normal value ( both command will override settings which was set as row@style ) >>I'd like to understand why afterInit does not work. commands from afterInit section called when data loaded and parsed, so it must not appear before data loading, and always appears after it. ( there is one limitation - distributed parsing mode, where commands may be executed in moment , when not all data loaded yet ) If problem still occurs - please provide grid initialization code ( because used XML is definitely correct ) Answer posted by Julien Sobrier on Dec 25, 2007 20:31 Hello, here is the initialization code: Mygrid = new dhtmlXGridObject('gridbox'); Mygrid.setImagePath("grid/imgs/"); Mygrid.setHeader(" , Date, Title,url",", ","play,date,title,url"); Mygrid.setInitWidths("18,105,205,0"); Mygrid.enableResizing("false,true,true,false"); Mygrid.setColAlign("left,left,left,left"); Mygrid.setColTypes("ro,ro,ro,ro"); Mygrid.enableMultiselect(false); Mygrid.enableRowsHover(true,'grid_hover'); Mygrid.enableAlterCss("even","uneven"); Mygrid.enableBuffering(30); Mygrid.preventIECaching(true); Mygrid.init(); Mygrid.loadXML("data.xml"); Thank you Answer posted by Stanislav on Dec 27, 2007 14:41 Problem caused by next line >>Mygrid.enableBuffering(30); without it command will work from XML. In current state command executed, but it may not affect row if its stored unparsed in buffer on moment of command call. Answer posted by Julien Sobrier on Dec 31, 2007 11:58 Hello, I removed this line, but I get an error: this.getRowById(row_id) has no properties with this: <head><afterInit><call command="setRowTextBold"><param>2</param></call></afterInit></head> My grid does contain more then 5 rows. It looks like setRowTextBold is run before th grid is filled out. Also, I've tried to use <row id="2" style="font-weight: bold"> Then, when I try Mygrid.SetRowTextNormal(2) or Mygrid.getRowById(2).style.fontWeight = "normal"; the style is not changed. However, if I try <row id="2"> , Mygrid.getRowById(2).style.fontWeight = "bold"(or = "normal"), it does work. It looks like when I put the wight-font in the style, I cannot hange it throughh Javascript later. Thank you |