Forum


02:32

06/08/2010

Hi
I would like to get the column index as defined at the colModel. i.e. “country”.
I got always the column “index number” i.e. “4” at the “onCellSelect” method.
I’m using column reordering, too. After the columns have been reordered the column index numbers are changed as well.
In other words the “country” column index number has no longer the value “4”. And here is my issue :
I try to implement more than one hyperlink at the same row, depending on the cell click.
Therefore I need to know if someone click at the “country” cell. With the changed column index numbers I guess I can't figure out.
I use the following not perfect workaround :
onCellSelect: function(id,cellidx,cellvalue) {
var row= jQuery("#list1").jqGrid('getRowData',id);
if(cellvalue== row.country){
// ajax call URL 1
}
else
if(cellvalue== row.name){
// ajax call URL 2
}
else
return false;
…
}
BTW:
colNames: ['ID','Name', 'Last Login', 'Country','Active','Time Zone','Local Format','First','Last','Email'],
colModel : [
{name : 'id', index : 'id', width : 40, sorttype : 'int', align: 'center'},
{name : 'name', index : 'name', width : 80, sorttype : 'text', align: 'left'},
{name : 'lastlogin', index : 'lastlogin', width : 80, sorttype : 'date', align: 'left',hidedlg :'true'},
{name : 'country', index : 'country', width : 80, align: 'left'},
{name : 'user_active', index : 'user_active', width : 80, align: 'right'},
{name : 'timezone', index : 'timezone', width : 80, align: 'right'},
{name : 'number_format', index : 'number_format', width : 80, align: 'right'},
{name : 'firstname', index : 'firstname', width : 80, align: 'right'},
{name : 'lastname', index : 'lastname', width : 80, align: 'right'},
{name : 'email', index : 'email', width : 80, align: 'right' }
],
Any ideas how I can get the column index name instead of the column index number?
Thanks!
Most Users Ever Online: 715
Currently Online:
151 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