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
How to get ColModel Name and Width
14/05/2010
13:42
Avatar
zenixgrace
Jakarta
Member
Members
Forum Posts: 41
Member Since:
10/05/2010
sp_UserOfflineSmall Offline

hiiii...

i'm a newbie..

i have a grid that code like that

jQuery('#tableGrid').jqGrid({
    scroll: 1,
       //url:'../admspanel/maingridrptsentmail.php',
    datatype: "xml",
    height: 470,
    mtype:"POST",
       colNames:['No','Mail', 'Count'],
       colModel:[
           {name:'no',index:'no', width:25, align:"right"},
           {name:'Mail',index:'Mail', width:515},
           {name:'countMail',index:'countMail', width:100, align:"right",formatter:'integer',formatoptions:{thousandsSeparator:","}},
       ],
       rowNum:100,
       //rowList:[10,20,30],
       pager: '#navGrid',
       sortname: 'Mail',
    viewrecords: true,
    sortorder: "asc",
    multiselect: false,
    subGrid : true,    
    reloadGrid:false,
    //subGridUrl: '../admspanel/subgridrptsentmail.php',
    subGridModel: [{ name  : ['No','Sent Date','Type','Subject','Mail'],
                    width : [25,100,100,200,300],
                    align : ['right'] }
    ],
    caption: "Examplel",
    footerrow: true,
    userDataOnFooter: true
});
jQuery('#tableGrid').jqGrid('navGrid','#navGrid',{add:false,edit:false,del:false,search:false,refresh:false});

i try to get name and width of colModel

my code to get col model like that

var a = $("#tableGrid").jqGrid('getGridParam','colModel');
alert(a);

it return [object object], [object object], [object object], [object object]

how can i get that name and width of colmodel?

is my code wrong ?

correct me if i have wrong..

what should i do to complete it?

can some body help me?

Thanks

17/05/2010
06:24
Avatar
michaelg
Member
Members
Forum Posts: 51
Member Since:
10/04/2010
sp_UserOfflineSmall Offline

Hi zenixgrace,

I believe that this code is what you want ...

var a = $("#tableGrid").jqGrid('getGridParam','colModel');

alert(a[0].name);

alert(a[0].width);

alert(a[1].name);

alert(a[1].width);

etc.

Cheers,

Michael

17/05/2010
09:09
Avatar
zenixgrace
Jakarta
Member
Members
Forum Posts: 41
Member Since:
10/05/2010
sp_UserOfflineSmall Offline

thanks michaell...

it works..

u know what i want..

😀

but why the return value is not same with the origin value

in that example i set col no width 25 when i call the col no width its return 24..

it occur at the others col width..

it's a bug or not?

Best Regards,

Zenixgrace

18/05/2010
01:27
Avatar
michaelg
Member
Members
Forum Posts: 51
Member Since:
10/04/2010
sp_UserOfflineSmall Offline

Hi Zenixgrace,

I'm not sure to be honest, but i do know that the width returned will be the current width after resizing the columns.  I use that code to get the column size after the user resizes it so that I can save it and restore its size later on

Cheers,

Michael

18/05/2010
13:39
Avatar
zenixgrace
Jakarta
Member
Members
Forum Posts: 41
Member Since:
10/05/2010
sp_UserOfflineSmall Offline

Laugh Laugh Laugh

thanks u michael..

your information are very help me..

thanks u so much sir..

Best regards,

Zenixgrace

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
45 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