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
get column "index name" onCellSelect event after column reorder
07/08/2010
02:32
Avatar
.tel
Member
Members
Forum Posts: 4
Member Since:
06/08/2010
sp_UserOfflineSmall Offline

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!

07/08/2010
10:50
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

You can use following code

var cm = jQuery("#list1″).jqGrid("getGridParam", "colModel");
var colName = cm[iCol];

to get the column name colName from the column number iCol.

Best regards
Oleg 

07/08/2010
11:53
Avatar
.tel
Member
Members
Forum Posts: 4
Member Since:
06/08/2010
sp_UserOfflineSmall Offline

Hi Oleg,

thanks!  (Vielen Dank)

var cm = jQuery("#list1″).jqGrid("getGridParam", "colModel");
var colName = cm[iCol];
alert(colName['index']);

is exactly where I was looking for! 

Thanks again

.tel

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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