Categories | Question details Back To List | ||
setColspan failing... ?? I have used the setColspan multiple times, however for reasons I cannot figure out when I run the following code it removes the text from the grid instead of spanning GRID SETUP: grdNewOrderSelections = new dhtmlXGridObject('grdNewOrderSelections_Container') grdNewOrderSelections.setSkin("mt"); grdNewOrderSelections.setHeader(",,,"); grdNewOrderSelections.setNoHeader(true); grdNewOrderSelections.setInitWidths("20,135,45,20"); grdNewOrderSelections.setColTypes("txt,ro,ro,ro"); grdNewOrderSelections.setColAlign("right,left,right,right"); grdNewOrderSelections.enableColSpan(true); grdNewOrderSelections.attachEvent("onMouseOver",function(id,ind){return false}); grdNewOrderSelections.init(); JAVASCRIPT FUNCTION: function gridAddRowNOSSRestaurantName(sRestaurant) { var sStyle = "color:#58585a;font-family:Arial;font-weight:bold;font-size:10pt;text-align:left;"; grdNewOrderSelections.cells(0, 0).setValue(sRestaurant); grdNewOrderSelections.setRowTextStyle(0,sStyle); alert('test') //<-- i can see the text in the grid when I pause here grdNewOrderSelections.setColspan(0,0,2); alert('test') //<-- the text is cleared Any thoughts? Thanks, James } Answer posted by dhxSupport on Aug 31, 2009 01:46 Issue occurs because of you are using row indexed instead of row ids. First parameter of cells(rowId,cellIndex) method is row id, not row index. "0" is illegal value for row id. Also first parameter of setColspan() method is row id, not row index. You can get id of the row by it's index with getRowId(ind) method: var rowID=mygrid.getRowId(0); Answer posted by James Snyder on Aug 31, 2009 06:53 Thanks, but that still doesn't solve the problem. When I first populate the row the code is as follows: grdNewOrderSelections.addRow(123,'Please select an item'); That code works fine. However, during the following code I can see the restaurant name (sRestaurant) in the grid when the first alert is shown, however when the second alert is shown the restaurant name disapears. function gridAddRowNOSSRestaurantName(sRestaurant) {
Thoughts?
Answer posted on Aug 31, 2009 07:41 >>grdNewOrderSelections.cells(123, 0).setValue(sRestaurant); To prevent type coercion issues row id must be included at the single or double quotes: grdNewOrderSelections.cells("123", 0).setValue(sRestaurant); >>however when the second alert is shown the restaurant name disapears. Does your browser returns any errors? Can you please provide complete example where we can reproduce this issue? Answer posted by James Snyder on Aug 31, 2009 07:51 No errors are returned, it simply just clears the line. Strange. However, since the same row has a colspan of 4 (previous code) the span works ok so long as I do not change it. Strange, but satisfactory. So, don;t stress about it. If you find something, then let me know, otherwise I can live with it. Thanks again for your time. Answer posted by dhxSupport on Sep 01, 2009 02:01 Can you please provide full example where we can reproduce this issue? So if issue really exists we will fix is as soon as possible. |