Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Daniel Ecer on Mar 03, 2009 04:47
open dhtmlx forum
column widths not always restored

Hi,

The column width is not always restored. It seem to change work/not-work depending on the columns added. Maybe a timing issue.

All the column configuration is part of the XML.

This is is an extract of it:
    <head>
        <beforeInit><call command="enableOrderSaving"><param>myTree</param></call></beforeInit>
        <beforeInit><call command="enableAutoSizeSaving"><param>myTree</param></call></beforeInit
>
        <beforeInit><call command="setImagePath"><param>...</param></call></beforeInit
>
        <beforeInit><call command="preventIECaching"><param>true</param></call></beforeInit>
        <beforeInit><call command="enableSmartRendering"><param>true</param></call></beforeInit>
        <beforeInit><call command="enableColumnMove"><param>true</param></call></beforeInit>
        <beforeInit><call command="enableMultiselect"><param>true</param></call></beforeInit>
        <beforeInit><call command="attachHeader"><param>#text_filter,#select_filter_strict,,#text_filter,,
#select_filter_strict,#select_filter_strict,#select_filter_strict,#select_filter_strict,#text_filter
</param></call></beforeInit>
        <afterInit><call command="setSkin"><param>...</param></call></afterInit>
        
        <afterInit><call command="enableAutoHeight"><param>true</param><param>auto</param></call></afterInit
>
        <afterInit><call command="adjustAutoSize"></call></afterInit>
        <afterInit><call command="setFiltrationLevel"><param>-2</param></call></afterInit>
        <afterInit><call command="loadOrderFromCookie"><param>myTree</param></call></afterInit>
        <beforeInit><call command="loadSizeFromCookie"><param>myTree</param></call></beforeInit>
        <column id="column0" sort="str" align="left" width="250" type="tree">Column0</column><column id="column1"
sort="str" align="left" width="90" type="ro">Column1</column><column id="column2" sort="str" align="left"
width="90" type="ro">Column2</column><column id="column3" sort="str" align="left" width="90"
type="ro">Column3</column><column id="column4" sort="str" align="left" width="90" type="ro">Column4</column
><column id="column5" sort="str" align="left" width="50" type="ro">Column5</column><column id="column6"
sort="str" align="left" width="50" type="ro">Column6</column><column id="column7" sort="str" align="left"
width="50" type="ro">BG</column><column id="column8" sort="str" align="left" width="50" type="ro">Column8</column><column id="column9" sort="str" align="left" width="90" type="ro">Column9</column>
    </head>

Debugging showed that the cookie is correctly updated and even restored. But something is reseting the column widths afterwards. (Sometimes removing a column made it work)
The column order is saved/restored all the time though.

(Tested with version dhtmlxSuite_2008Rel3_pro_81009)

Kind Regards
Daniel
Answer posted on Mar 03, 2009 05:59
Try to move enableAutoSizeSaving and loadSizeFromCookie in afterInit block
<afterInit>
<call command="loadOrderFromCookie"><param>myTree</param></call>
<call command="loadSizeFromCookie"><param>myTree</param></call> 
<call command="enableAutoSizeSaving"><param>myTree</param></call></afterInit> 

In such case size saving will be initialized only after data loaded from cookies, so it will not have chance to overwrite old data before real loading



>>Sometimes removing a column made it work
Please beware that grid has logic , which will ignore loadOrderFromCookie command if count of columns in current grid is lesser that count of column saved in cookies.
Answer posted by Daniel Ecer on Mar 03, 2009 06:41
Thank you for your response.
I did try that without luck.
But I did also try passing in another name to the enableOrderSaving/AutoSizeSaving function. The result is that only the other cookie is saved. But the column width does not seem to be restored from the cookie.
For example here is the contents of the cookie:
248,278,88,88,88,48,48,48,48,88|248,8...8,48,48,48,48,88||0,2,3,1,4,5,6,7,8,9|

In that case the second column was resized (from less than 100).
Answer posted by Support on Mar 03, 2009 07:23
What is functionality of   <afterInit><call command="adjustAutoSize"> ?
There is no default command with such name. 
Answer posted by Daniel Ecer on Mar 03, 2009 07:36
It is our own function to adjust the total width of the grid if necessary (it may change the width of the parent and call setSizes).
But because it appears before the call to loadSizeFromCookie I wouldn't expect it to interfere.
Answer posted by Support on Mar 04, 2009 03:38
The sample with the same init code works correctly locally ( working sample sent by email ) 
If issue still occurs for you - please provide any kind of sample where issue can be reconstructed ( you can send it directly to support@dhtmlx.com )