Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Column Order
12/08/2009
14:36
Avatar
Steve
Guest
Guests

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

13/08/2009
02:38
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

13/08/2009
06:15
Avatar
Steve
Guest
Guests

Well I would change the order of the items in the colModel.

13/08/2009
10:11
Avatar
Steve
Guest
Guests

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"
        });

15/08/2009
02:16
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information