Forum


14:36

Hi,
I cant seem to figure the trick to defining the order that columns appear in. Here is my column definition (I dont use the colNames attribute):
{label: 'Channel', name: 'ChannelName', index: 'ChannelName', sortable:false},
{label: 'Title', name: 'Title', index: 'Title', sortable:false},
{label: 'StartDate', name: 'StartDate',index: 'StartDate', sortable:false},
{label: 'StartTime', name: 'StartTime',index: 'StartTime', sortable:false},
{label: 'EventCode', name: 'EventCode',index: 'EventCode', sortable:false},
{label: 'Price', name: 'Price', index: 'Price', sortable:false}
No matter what order I place those columns in the following always happens:
1) The labels change positions as you would expect
2) The data always appears in the following order: Title, Price, EventCode, ChannelName, StartDate, StartTime
How do I tie the column header to the data?
Thanks
Steve
02:38

Moderators
30/10/2007

Hello,
Do not undestand - how do you try to change the order?
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.
10:11

I dont want to have to define the order of the columns in the data service. I think that it is better that the grid determines the order of columns. Because I cannot seem to figure out how to get jqGrid to do this I have decided to use the 'postData' attribute to pass back a list of columns in the order that I want. The service then uses this list to sort the columns. Its not the optimum way to do it but its better than hardcoding the column order in the service itself.
If there is some other way to achieve this I would like to know.
jQuery('#ppv_history').jqGrid({
url: '/subscribers/get_ppv_history',
mtype: 'POST',
datatype: 'json',
// This determines the order of columns. It MUST match the colModel
postData: {colOrder: 'ChannelName,Title,StartDate,StartTime,EventCode,Price'},
colModel: [
{label: 'Channel', name: 'ChannelName', index: 'ChannelName', sortable:false, width: '40', },
{label: 'Title', name: 'Title', index: 'Title', sortable:false},
{label: 'StartDate', name: 'StartDate',index: 'StartDate', sortable:false,width: '40', align: 'right'},
{label: 'StartTime', name: 'StartTime',index: 'StartTime', sortable:false,width: '40', align: 'right'},
{label: 'EventCode', name: 'EventCode',index: 'EventCode', sortable:false,width: '40', align: 'right'},
{label: 'Price', name: 'Price', index: 'Price', sortable:false,width: '25', align: 'right'}
],
pager: jQuery('#pager'),
rowNum: 10,
rowList: [10, 20, 30],
sortname: 'Title',
sortorder: 'asc',
viewrecords: true,
autowidth: true,
height: 'auto',
emptyrecords: "No records to view"
});
02:16

Moderators
30/10/2007

Hello,
I really do not understand what you try to do.
Once the grid is created you can not reorder the columns.
If you want dynamically to reorder the columns when the grid is created, I recommend you to use
the so named jqGridImport method - where you can load the grid from xml or json - see docs
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.
Most Users Ever Online: 715
Currently Online:
84 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