Forum


17:27

16/10/2009

I am exporting, saving to server and then importing grid options. I use this to save my user's preferences for data sorting, column width and column re-ordering.
That last feature, column re-ordering is a bit of a problem. The grid options are exported and saved with the correct "remapColumns" parameter–it's the permutation array. When the grid loads and the saved options are imported, the columns are properly ordered by the permutation array but the column headings are left in the original, default order.
gridOptions.remapColumns is exported as an array when using the grid export feature:
. . .
,"remapColumns":[1,2,4,3,5,6]
. . .
};
again, this approach reorders the columns but leaves the headers in the wrong order.
I have also tried updating the remapColumns option before binding the grid so that it matches the remapColumns method signature:
. . .
,"remapColumns":{"permutation":[1,2,4,3,5,6],"updateCells":true,"keepHeader":true}
. . .
};
This last approach doesn't work at all on the columns OR the header row.
Many thanks for such a cool control!! Can anyone tell me what I'm missing here or help me identify a bug?
Thanks!
18:46

Moderators
30/10/2007

Hello,
Do you have hidden fields?
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
22:58

16/10/2009

Hey Tony! Thanks for your reply. There are, indeed, some hidden fields. This is another one of the features I am saving to the server as my user's settings. Some columns permanently hidden by default and others might end up hidden by the user. Thanks, David
tony said:
Hello,
Do you have hidden fields?
Best Regards
Tony
12:12

Moderators
30/10/2007

Hello,
Will look at this.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
22:00

16/10/2009

17:10

Moderators
30/10/2007

Hello,
Currently we check this bug
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
14:57

Moderators
30/10/2007

Hello,
Sorry no. I do not have a chance to investigate this, but definetley will do it.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
15:57

12/11/2009

BTW a simple fix for this is just to make all your columns visible in the data column array. Then in loadBeforeSend first time callback hide the columns bar $('.ui-jqgrid-hdiv').hide() . On gridComplete first time callback call $('#yourGrid').jqGrid('remapColumns',colOrderArry,true,false) and then buildup an array of those columns you want to hide and call $('#yourGrid').jqGrid('hideCol',colArray) and then $('.ui-jqgrid-hdiv').show() to show the column header. This gets over the problem 'remapColumns' has with hidden columns.
22:34

07/01/2011

Hi Teddyboy,
Thanks for post this workaround.
Just one question regarding this proposed solution.
The main sortable (column reordering) feature works properly as expected.
But after I reordered some columns and try afterwords to sort one or more columns (asc or desc by clicking onto the column header), my table columns toggle around. In other words I clicked i.e. at column #5 and column #5 becomes column #3 and the original column #3 becomes #5. with another click onto a different column header (totally independed on which one) the columns are toggle back.
...,
loadBeforeSend : function() {
jQuery('.ui-jqgrid-hdiv').hide();
},
gridComplete: function() {
var rv=document.getElementById('column_order').value.split(","); //[0,1,2,3,4,5,6,7,8,9,10,11,12]
jQuery("#list1").jqGrid("remapColumns",rv, true, false);
var hv=document.getElementById('hidden_columns').value.split(","); //['id','product']
jQuery('#list1').jqGrid('hideCol',hv);
jQuery('.ui-jqgrid-hdiv').show();
},...
BTW as hint: I got more than one sort arrow at the grid (but just one per column). That's strange, but just with the above descripted senario.
Thanks
Nils
Most Users Ever Online: 715
Currently Online:
55 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66