Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Vikram Jagannathan on Mar 26, 2009 07:54
open dhtmlx forum
enableAutoSaving does not work after columnDelete

Hi,

enableAutoSaving does not work if it is invoked after deleting a column in the grid. It works fine otherwise.

I am using pro v.2.0

Test Case:
Please use the following script in pro_column_states_save.html. Two delete statements have been included.

<script>
mygrid = new dhtmlXGridObject('gridbox');
    mygrid.setImagePath("../../codebase/imgs/");
    mygrid.enableColumnMove(true)
    mygrid.loadXML("gridH.xml",function() {
        mygrid.deleteColumn(0);
    });

mygrid2 = new dhtmlXGridObject('gridbox2');
    mygrid2.setImagePath("../../codebase/imgs/");
    mygrid2.enableAutoSizeSaving();
    mygrid2.enableSortingSaving();
    mygrid2.enableColumnMove(true)
    mygrid2.enableOrderSaving();
    mygrid2.loadXML("gridH.xml",function(){
        mygrid2.deleteColumn(0);
        mygrid2.loadOrderFromCookie();
        mygrid2.loadSizeFromCookie();
        mygrid2.loadSortingFromCookie();
    });
</script>

Can you please provide me a solution/fix?

Thanks.
Answer posted by dhxSupport on Mar 26, 2009 08:45

enableAutoSaving method save in cookies only column width, hidden state of a column, index of a column if it has been moved, sorting order, open state of the item for the treeGrid. When you are deleting column no one of this actions happen. After deleting a column you can serialize grid to the xml and at the next time load grid from this serialized xml. Please see example here http://dhtmlx.com/docs/products/dhtmlxGrid/samples/serialization/pro_serialize_column.html

Answer posted by Vikram Jagannathan on Mar 26, 2009 09:30
Hi dhxSupport,

The question is NOT about the delete action per se. If a column is deleted from the grid, enableAutoSaving method does not save subsequent column order after it is moved, in cookies. If the columns are not deleted, subsequent column moves are saved in the cookies.

Sample Steps: Test Case File: pro_column_states_save.html

SUCCESS CASE:
1) Initialize and load mygrid.
2) Move "Author" column to index position 4.
3) Click on "save order" button to save the column order in cookies.
4) Move "Author" column to index position 6.
5) Click on "restore order" button.
Result:
  - "Author" column is moved back to index position 4.
 
FAILURE CASE:
1) Initialize and load mygrid.
2) Delete "Sales" column (index 0).
3) Move "Author" column to index position 4.
4) Click on "save order" button to save the column order in cookies.
5) Move "Author" column to index position 6.
6) Click on "restore order" button.
Result:
  - "Author" column is still in index position 6. It does NOT move to index position 4.
 
Please let me know if you need more clarification on the question.

Thanks.
Answer posted by Support on Mar 27, 2009 03:59
Problem confirmed and fixed. Fixed js file sent by email. 
( please beware that in situation when column deleted after column moving, it still will not be able to restore previous order ) 
Answer posted by Vikram Jagannathan on Mar 27, 2009 06:05

Hi Support,

Thank you!

But I did not receive the fixed js file. Not sure if there is an email filter put up at my place. Can you please suggest an alternate method for sending the file?

Thanks.

Answer posted by Support on Mar 27, 2009 11:07
You can contact support@dhtmlx.com directly and they will send you fix