Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Brian Huisman on Nov 17, 2008 12:30
open dhtmlx forum
Filtering throws an error after column removal/addition (dhtmlxGrid)

We're building a dynamically-filled table of items. Every column beyond the first two can be #text_filter'd via an attached additional header row. The user can also add or delete columns at will which results in the following steps being processed:

- detach sort row header (detachHeader)
- insert column (insertColumn) or delete column (deleteColumn)
- attach new, updated sort header (attachHeader)
- refresh sort filters (refreshFilters)
- reset column sizes (setSizes)

However, after these steps it appears the table structure changes haven't been fully propagated to the filtering module. For example, when the table has four columns, and a new column is inserted at position 4 (pushing the current column 4 to become column 5), attempting to filter the new column 4 works, but filtering column 5 throws a JS error:

this._get_cell_value(this.rowsBuffer[i], column) is undefined
function(column,value){if (value=="")return;var d=true;if (typeof(value)=="function") d=false;else value=(value||"").toString().toLowerCase();if (!this.rowsBuffer.length)return;for (var i=this.rowsBuffer.length-1;i>=0;i--)if (d?(this._get_cell_value(this.rowsBuffer[i],column).toString().toLowerCase().indexOf(value)==-1):(!value(this._get_cell_value(this.rowsBuffer[i],column),this.rowsBuffer[i].idd)))

Likewise, if the user loads a table with five columns and deletes column 4, filtering column 3 still works fine, but filtering the new column 4 (formerly column 5) throws the same error as above. If the page is refreshed and the updated number of columns is rewritten from scratch, filtering works properly again.

Is there some step in the add/delete process which I am missing? Or is this a quirk in the filtering system?

Regards,
Brian
Answer posted by Support on Nov 18, 2008 02:15
Which version of dhtmlxgrid you are using?
The issue can't be reconstructed for dhtmlxgrid 2.0, but there is a known issue with dhtmlxgrid 1.6, which can throw an error, when column with filter was removed from grid. 

Updated js files sent by email, please try to use them instead of original ones.

Also , beware that columns included in colspan can't be correctly removed from grid