Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by James Snyder on Jul 29, 2009 07:56
open dhtmlx forum
setColSpan + object doesn't support this property or method

I have been working with your grid for 6 months now, and have used the enableColSpan/setColSpan more than a few times. However for reasons I cannot understand I am having an issue. Please review and let me know what I am doing wrong


THE GRID SETUP:
grdSelectItems = new dhtmlXGridObject('grdSelectItems_Container');
grdSelectItems.setHeader(",,,,");
grdSelectItems.setNoHeader(true);
grdSelectItems.setInitWidths("200,70,20,200,70");
grdSelectItems.setColTypes("txt,ro,ro,txt,ro");
grdSelectItems.setColAlign("left,right,center,left,right");
grdSelectItems.attachEvent("onMouseOver",function(){return false;});
grdSelectItems.attachEvent("onScroll",function(x,y){miItemScrollValue=y;});
grdSelectItems.enableColSpan(true);
grdSelectItems.init();


THE FUNCTION CALL:
function gridAddRowSelectItemSection(sHeader,sDesc,bExtraRow) {
var sStyle = "color:#58585a;font-family:Arial;font-weight:bold;font-size:9pt;height:15px;";
var iRow = (grdSelectItems.getRowsNum() + 1);
    
    
sHeader = replaceAll(sHeader,',', ',');
grdSelectItems.addRow((iRow+1),sHeader+",,,,");
grdSelectItems.setRowTextStyle((iRow+1), sStyle);
    
if (sDesc.length > 0){
    sDesc = replaceAll(sDesc,',','&44;')
    sStyle = "color:#58585a;font-family:Arial;font-weight:normal;font-style:italic;font-size:8pt;height:14px;";
    grdSelectItems.addRow((iRow+2),sDesc+",,,,");
    grdSelectItems.setRowTextStyle((iRow+2), sStyle);
    grdSelectItems.setColSpan((iRow+2),0,2) //ISSUE HERE
}
}
Answer posted by dhxSupport on Jul 29, 2009 08:45
>>object doesn't support this property or method
Such issue may occur if you doesn't include necessary file to your page. Please check if dhtmlxgrid_rowspan.js file is attached
Answer posted by James Snyder on Jul 29, 2009 10:32

Thanks for the quick response!  I added the file you mentioned, however this did not fix the issue.

Our site uses the setColSpan in several areas without this issue AND without having used that file.  Any thoughts?

Thanks,
James

Answer posted by dhxSupport on Jul 30, 2009 01:47
Could you please provide us full example where we can reproduce this issue locally including files which you are using to initialize grid. (Please send this example directly to the support@dhtmlx.com)
What changed did you do since setColspan() method doesn't work? What version of dhtmlxGrid do you use?
Answer posted by James Snyder on Jul 30, 2009 06:19

Here is the grid init:

grdSelectItems = new dhtmlXGridObject('grdSelectItems_Container');
grdSelectItems.setHeader(",,,,");
grdSelectItems.setNoHeader(true);
grdSelectItems.setInitWidths("200,70,20,200,70");
grdSelectItems.setColTypes("txt,ro,ro,txt,ro");
grdSelectItems.setColAlign("left,right,center,left,right");
grdSelectItems.attachEvent("onMouseOver",function(){return false;});
grdSelectItems.attachEvent("onScroll",function(x,y){miItemScrollValue=y;});
grdSelectItems.enableColSpan(true);
grdSelectItems.init();


Here is the web page's includes:

<script src="../scripts/dhtmlxcommon.js" type="text/javascript" ></script>
<script src="../scripts/dhtmlxgrid.js" type="text/javascript"></script>
<script src="../scripts/dhtmlxgridcell.js" type="text/javascript"></script>
<script src="../scripts/dhtmlxcombo.js" type="text/javascript"></script>
<script src="../scripts/dhtmlxgrid_excell_combo.js" type="text/javascript"></script>
<script src="../scripts/dhtmlxgrid_rowspan.js" type="text/javascript"></script>


This is the function that is having the issue:

function gridAddRowSelectItemSection(sHeader,sDesc,bExtraRow) {
    var sStyle = "color:#58585a;font-family:Arial;font-weight:bold;font-size:9pt;height:15px;";
    var iRow = (grdSelectItems.getRowsNum() + 1);
 
 if (iRow > 1) {
  // a line to visually separate the groups
  if (bExtraRow){
   grdSelectItems.addRow(iRow,",,,,");
   grdSelectItems.setRowTextStyle(iRow,"height:8px;font-size:8px");
  }
 }
 
 sHeader = replaceAll(sHeader,',', '&#44;');
 grdSelectItems.addRow((iRow+1),sHeader+",,,,");
 grdSelectItems.setRowTextStyle((iRow+1), sStyle);
 
 if (sDesc.length > 0){
  sDesc = replaceAll(sDesc,',','&44;')
  sStyle = "color:#58585a;font-family:Arial;font-weight:normal;font-style:italic;font-size:8pt;height:14px;";
  grdSelectItems.addRow((iRow+2),sDesc+",,,,");
  grdSelectItems.setRowTextStyle((iRow+2), sStyle);
  grdSelectItems.setColSpan((iRow+2),0,2) //M<-- THIS IS WHERE THE ISSUE IS
 }
}

 

Thank you kindly for your help,
James

Answer posted on Jul 31, 2009 01:59
Issue occurs because of grid hasn't 'setColSpan' method. It has 'setColspan' method.
Answer posted by James Snyder on Jul 31, 2009 07:40

That's more than a little embarasing.  (sorry I didn't notice it)


Thank you for your time! 
James