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 the index of the doubleclicked cell
27/01/2009
08:46
Avatar
phipps73
Member
Members
Forum Posts: 17
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

Hi,

I am trying to get the index of the cell in jqGrid that has been clicked on. I have tried all variations on using index() and get() and parent(), I can't seem to work out how to return the index of the click cell.

I have the following which picks up the doubleclick:

#list is the id of the grid body table.

$("#list").dblclick(function(e){

// return the index of the target cell in the table
var index = $(e.target).index(this);
alert(index); // this just returns -1
});

Any ideas how I can get the index of the clicked cell within the grid.

Cheers,

Dave

27/01/2009
09:06
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello Dave

Use onCellSelect event - see the docs. Also I expect some problems in IE in case you have a hidden coulnm.

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.

27/01/2009
09:40
Avatar
phipps73
Member
Members
Forum Posts: 17
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

Thanks Tony, but on this occasion I need to use an external dblclick handler because I am already using onSelectRow and onDblClickRow to enter inline editing mode.

When the user double clicks on certain cells a thickbox opens containing related info to the content of the clicked cell. I need to know the index so I can grab the corresponding header to work out which thickbox content to load.

Cheers,

Dave

27/01/2009
10:17
Avatar
phipps73
Member
Members
Forum Posts: 17
Member Since:
12/06/2008
sp_UserOfflineSmall Offline

Problem solved - here's the code that works:

$("table.scroll").dblclick(function(e){
   var index = e.target.cellIndex;
   var colname = $("table.scroll > thead > tr > th").get(index);
   var coltext = $(colname).children("div").text();
   alert(coltext);
}

Cheers,

Dave

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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