this.cellType is null or not an object loading Grid

I’m using the grid with the xmlB template. I get ‘this.cellType’ is null or not an object when the grid loads. The error is on line 3179 of the uncompressed dhtmlxgrid.js (in the isTreeGrid method). Code looks like this:

window.dhx_globalImgPath="../scripts/frameworks/dhx-2.5/imgs/";

var gridSearchResults = new dhtmlXGridObject({
  parent: 'searchResults',
  image_path: '../scripts/frameworks/dhx-2.5/imgs/',
  skin: 'modern',
  columns: [
    {label: 'Name', width: '*'},
    {label: 'Type', width: '80'},
    {label: 'Category', width: '80'}
  ]
    
});
gridSearchResults.setColumnIds("pproductfund_cname,pproductfund_ctype,pproductfund_ccategory");
gridSearchResults.setColTypes('ro,ro,ro');

//gridSearchResults.enableMultiselect(true);
gridSearchResults.init();

var timeoutHandle;

var lastSearch="";
function doSearch (searchString) {
  if (searchString != lastSearch && searchString != "") {
    lastSearch = searchString;
    if (timeoutHandle)
      clearTimeout(timeoutHandle);
    timeoutHandle = setInterval(reloadGrid, 500);
  }
}

function reloadGrid () {
  gridSearchResults.clearAll();
  gridSearchResults.load("productfundservice.asmx/productFundSelectionSearch?cname=" + document.getElementById('searchString').value, 
    function () {
      if (timeoutHandle)
        clearTimeout(timeoutHandle);
    },
    'xmlB'
  );
}

I’ve also tried putting the column types and IDs in the constructor object, but I get the same error. The XML returned looks like this:

<?xml version="1.0" encoding="utf-8"?>
<rows>
  <row id="25">
    <pproductfund_cname>SatuitWAP</pproductfund_cname>
    <pproductfund_ccategory>
    </pproductfund_ccategory>
    <pproductfund_cstyle>
    </pproductfund_cstyle>
  </row>
</rows>

Javascript files being loaded:

  <script type="text/javascript" src="../Scripts/Frameworks/dhx-2.5/dhtmlxcommon.js"></script>
  <script type="text/javascript" src="../Scripts/Frameworks/dhx-2.5/dhtmlxgrid.js"></script>
  <script type="text/javascript" src="../Scripts/Frameworks/dhx-2.5/dhtmlxgridcell.js"></script>
    <script type="text/javascript" src="../Scripts/Frameworks/dhx-2.5/ext/dhtmlxgrid_data.js"></script>
  <script type="text/javascript" src="../Scripts/Frameworks/dhx-2.5/ext/dhtmlxgrid_keymap_excel.js"></script>

I’ve confirmed using Fiddler that all files are loading.

Any ideas on what I’m missing?

Thanks,

Josh

Unfortunately we cannot reproduce this issue locally. You can check example here dhtmlx.com/docs/products/dht … o_api.html

If issue still occurs please open ticket at support.dhtmlx.com/ and provide us complete demo where we can reproduce this issue.

I’m still having the issue. Attached is a sample that reproduces it. I investigated a little further. It looks like cellType is set to an array of column types after the constructor runs, but when I call the init the following code runs which causes cellType to be set to null (starts at line 365 of uncompressed dhtmlxgrid.js):

if (this.hdr.rows.length > 0){
  this.clearAll(true);
}

Thanks for your help,

Josh
gridissue.zip (1.47 KB)

Try to comment the following line:

gridSearchResults.init();

Will this issue occur?

Olga,

If I remove the call to the init() method, everything works fine. Now I’m confused about when I should use that method. In the past it seems like I’ve needed it.

By the way, I just tried smart rendering for the first time and it works great. Huge speed improvement even without dynamic loading.

Thanks,

Josh

Now I’m confused about when I should use that method. In the past it seems like I’ve needed it.
If you are using object-initialization you have not to use init() method.
In your case when you call init() method grid configuration rewrites. This issue confirmed and will be fixed at next version of dhtmlxGrid.