Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Paul K on Aug 20, 2008 18:36
open dhtmlx forum
Delete column throws exception

I am trying to delete a column from a grid using deleteColumn just before I serialize the data. I get this error when the deleteColumn function is called:

Line: 13
Char: 1215
Error: 'this._col_combos.length' is null or not an object
Code: 0

Looking at other entries I see problems with cspan and rspan in the header. The grid has one row for the header and no cspan entries.

I am using the 1.6 professional version.
Answer posted by Support on Aug 21, 2008 02:19
Please try to use updated js file, which sent by email. 
Answer posted by Paul K on Aug 21, 2008 16:45
The patched file fixed the problem.  But now I have a problem with tooltips.

After the column is deleted, I serialize the grid data and save it.  Then I want to add back the column.  I start by inserting a new column:

    theGrid.insertColumn(2,"","ro",40,"","center","top",false);

then I populate the cells of the row.  The grid is displayed successfully. 

However now when I mouseover the contents of column 2 I get:

    Line: 570
    Char: 253
    Error: 'cell._attrs.title' is null or not an object
    Code: 0

When the grid was first initialized the cells column 2 are set to values that contain an html "a" tag and inside the tag is an img tag for a clickable button.  That img tag has a title attribute and its value is used as the tooltip when the page is first displayed.  After deleting the column and using the same HTML to set the value of the cells in the new column, the title attribute in the HTML is apparently not used for the title attribute of the cell.  So everytime I hover of the button I get the error.

Paul
Answer posted by Paul K on Aug 21, 2008 16:55
If I try to set the title attribute using the grid API:

    theGrid.cells(rowId,2).setAttribute("title", titleTip);  // Line 256

I get another error:

    Line: 38
    Char: 38
    Error: Object expected
   Code: 0

Paul
Answer posted by Support on Aug 22, 2008 02:21
>>If I try to set the title attribute using the grid API:

The error may occur in case when row in question doesn't exist
Please be sure that you are using valid rowId and that command called after data loaded from XML ( the data loading is async, so you need to use onXLE event or second parameter of load method to catch the moment when data loaded in grid )
Answer posted by Support on Aug 22, 2008 02:25
>>However now when I mouseover the contents of column 2 I get:
Updated js file sent by email, it must work correctly in described usecase.

Answer posted by Paul K on Aug 25, 2008 17:19
When I set the title for the grid, the code is in a forEach loop:

            theGrid.forEachRow(function (rowId) {
                theGrid.cellById(rowId,2).setValue(constructDeleteHTML(rowId,itemType));
                theGrid.cellById(rowId,2).setAttribute("title",titleTip);
           }

The grid data is not being read from XML at this point. 

However the patched dhtmlxgrid.js file seems to have removed the need for setting the title attribute.

Now I have a new problem.  The code deletes the column, serializes the data and sends it to the server.  Then using the same grid control the column is added back using insertColumn:

         theGrid.insertColumn(2,"","ro",30,"","center","top",false);

When this code is executed I see this error in the Firefox (version 3) error console:

Error: uncaught exception: [Exception... "Index or size is negative or greater than the allowed amount"  code: "1" nsresult: "0x80530001 (NS_ERROR_DOM_INDEX_SIZE_ERR)"  location: "http://xxxxxxx/codebase/ext/dhtmlxgrid_mcol.js Line: 225"]

(I had to use Firefox to see this error because it is not displayed in IE.  I normally use IE as the browser for this application.) 

The error occurs in the _addColInRow function for the dhtmlXGridObject.

Paul
Answer posted by Support on Aug 26, 2008 01:30
Problem can't be reconstructed locally. 
if issue still occurs for you - please provide any kind of sample or demo link where issue can be reconstructed.