After loading a 11 column grid from a csv string, as in
mygrid.loadCSVString(alltext);
I then try to change column width by
mygrid.setColWidth(0,"20");
The documentation says that the 2nd parameter of setColWidth is the width in px, but in my example it is definitely interpreting the value as a percentage.
How can I specify the column width to be in pixels?
Thanks
Command uses the current sizing mode of the grid.
It it was initially configured in percents - value will be counted as percents.
You can’t use a mixed configuration ( when part of columns defined in percents and part in pixels ). So if you want to define a fixed sizes for column you must define initial sizes in pixels as well.
Sorry, still can’t see how to set my grid to use px. I can see how to set my grid to use px if loading from xml (using px ), but I can’t see how to do it in the example below…
Any suggestions, thanks?
In case of loading from CSV with auto header, grid sets initial width of columns in percents.
You can use code like next
mygrid.parse (csvstr, "csv");
mygrid.cellWidthPX = [20,100,100]; //you need to define width for all columns
mygrid.cellWidthType = "px";
mygrid.setSizes();
I think the dhtmlx suite is brilliant - it’s what the web world has been waiting for, but as far as I can tell there is no documentation anywhere about cellWidthType as in…
mygrid.cellWidthType = “px”;
Consequently I wasted hours on this trivial issue, trying to think of work-arounds, and trying to avoid contacting the forum/support
The dhtmlx documentation in general, isn’t at all bad, but omissions like this does detract from the product.
If you can refer me to a link describing this attribute, I will eat my words !