Categories | Question details Back To List | ||
Incompatibility among versions Hi, I use the dhtmlXGridFromTable in the previous version and everything works. If I use the dhtmlXGridFromTable in the new version it doesn't work! In the same conditions! Some idea? Regards, CHW Answer posted by Support on Jul 02, 2008 02:00 The old version copied exact HTML from table directly in grid, which allowed to reflect HTML exactly as it was in table, but not allows to use API against such rows ( smart rendering mode for example ) Starting from dhtmlxgrid 1.6, source HTML table used only as datasource - only data from table cells used, any styles attached directly to TD|TR elements will be ignored - as result it allow to use all API of grid. Answer posted by CHW on Jul 02, 2008 12:08 Hi, Thank you very much,
Perfect. I understood everything.
But it is that the styles of the cells are incorporate in my HTML. I need a lot this.
Therefore I need to maintain compatibility of the two versions.
It is possible to put a new parameter in the dhtmlXGridFromTable, for instance: "type", where type is the way of treating the styles?
I can try to alter the dhtmlxgrid_start.js, but I don't know if side effects exist!
Can you give some instructions about the alteration?
Regards,
CHW Answer posted by Support on Jul 08, 2008 02:40 >>Can you give some instructions about the alteration? The key point is a _process_html_row method, it converts HTML row to grid's data structure. dhtmlXGridObject.prototype._process_html_row=function(r,xml){ var cellsCol = xml.getElementsByTagName('TD'); var strAr = []; r._attrs=this._xml_attrs(xml); // this line copy and store all attributes or row tag for(var j=0;j<cellsCol.length;j++){ var cellVal=cellsCol[j]; var exc=cellVal.getAttribute("type"); if (r.childNodes[j]){ if (exc) r.childNodes[j]._cellType=exc; r.childNodes[j]._attrs=this._xml_attrs(cellsCol[j]); //copy all attributes or TD tags //if you have some styling attributes you can reflect them as the style attribute r.childNodes[j]._attrs["style"]="background-color:"+cellsCol[j]+";"; //store bgcolor attribute as part of cell's data |