Hello!
It seems that loadSortingFromCookie not intended to work this way, but I think it should, anyway.
Testcase:
- build a grid with soringsaving
- enable sorting saving to cookie
- insert column in grid with grid.insertColumn
- sort grid by the last column (point is to sort grid by column index, that not exists in original column)
- remove inserted column in any way u like (deleteColumn or either reloading page to reset it state)
- restore sorting by loadSortingFromCookie
You should receive error: cellType is null or not object at this function:
this.cells4 = function(cell){
var type=window["eXcell"+(cell._cellType||this.cellType[cell._cellIndex])];
if (type) return new type(cell);
dhtmlxError.throwError("Incorrect cell type : "+type);
}
What actual problem is: loadSortingFromCookie gets data and trys to sort grid, without data integrity check, so when it gets wrong column, other functions fails, since column ain’t defined at all. Unfortunately u can’t check result before using this function.
Is there a right way to avoid this issue in described situation or this function ain’t intended to work with it?
Thank you.
Problem confirmed and mostly fixed ( now grid will not restore sorting | columns order when it may cause js error )
Fix will be available as part of next build , if you need it ASAP - please contact us directly at support@dhtmlx.com