Hi,
I’m loading a grid dynamically according to the search condition.
like when search by April 30 columns will be loading, and May with 31 columns.
I’m using grid.deleteColumn and grid.insertColumn function to achieve it.
it works perfect after only deleteColumn
but there is a javascript error when grid data loading after deleteColumn and insertColumn.
error message:
INFO: ‘_attrs.style’ is null or not an object
line: 5054
error file: dhtmlxgrid.js
before loading grid below source code will be execute first.
function fncSetColLabel(curYear, curMonth){
var curMonthDays = new Date(curYear, curMonth, 0).getDate();
var afterCount = curMonthDays;
var colNum = oGrid.getColumnsNum();
var beforeCount = (colNum - 2)/4;
if( beforeCount > afterCount ){
var j = beforeCount - afterCount;
for( var i=0; i<j; i++ ){
oGrid.deleteColumn(colNum-(i+1));
oGrid.deleteColumn(colNum-(i+2));
oGrid.deleteColumn(colNum-(i+3));
oGrid.deleteColumn(colNum-(i+4));
colNum -= 4;
}
}
else if( beforeCount < afterCount ){
var j = afterCount - beforeCount;
for( var i=0; i<j; i++ ){
oGrid.insertColumn(colNum+(i+1), curMonth+"-"+(beforeCount+i+1)+" TEAM", "ro",10,"na","center",null,null,null );
oGrid.insertColumn(colNum+(i+2), curMonth+"-"+(beforeCount+i+1)+" Pgm Name", "ro",10,"na","center",null,null,null );
oGrid.insertColumn(colNum+(i+3), curMonth+"-"+(beforeCount+i+1)+" COUNT", "ro",10,"na","center",null,null,null );
oGrid.insertColumn(colNum+(i+4), curMonth+"-"+(beforeCount+i+1)+" SEC", "ro",10,"na","center",null,null,null ); colNum -= 4;
}
}
var coInd = cInd_rank;
for( var i=1; i<afterCount+1; i++ ){
if( i < 10 ){
i = "0" + i;
}
oGrid.setColumnLabel(coInd+1, curMonth+"-"+i+" TEAM");
oGrid.setColumnLabel(coInd+2, curMonth+"-"+i+" Pgm Name");
oGrid.setColumnLabel(coInd+3, curMonth+"-"+i+" COUNT");
oGrid.setColumnLabel(coInd+4, curMonth+"-"+i+" SEC");
coInd += 4;
}
}
what’s the problem?
Thanks for any reply.
Best Regards