admin管理员组文章数量:1432607
I'd like to be able to double click on any part of a given row and open a new html page (based on specific cell value/content). Basically I have all NY counties, each in one row:
County - City - State
Manhatan - New York - NY
Brooklyn - New York - NY
Bronx - New York - NY
Westchester - New York - NY
etc.
I need to be able to get the cell value in the County column and use it to run a function. Example: if I double click on the first row, that should open a new html page about Manhattan. I tried some answers that were posted for a kind of similar question (about editing) but they didn't work.
I'd like to be able to double click on any part of a given row and open a new html page (based on specific cell value/content). Basically I have all NY counties, each in one row:
County - City - State
Manhatan - New York - NY
Brooklyn - New York - NY
Bronx - New York - NY
Westchester - New York - NY
etc.
I need to be able to get the cell value in the County column and use it to run a function. Example: if I double click on the first row, that should open a new html page about Manhattan. I tried some answers that were posted for a kind of similar question (about editing) but they didn't work.
Share Improve this question edited May 22, 2013 at 13:17 enb081 4,06112 gold badges45 silver badges66 bronze badges asked Feb 21, 2012 at 18:07 M BenmosM Benmos 993 silver badges13 bronze badges2 Answers
Reset to default 4$('table').on('dblclick', 'tr', function() {
var rowCountry = $(this).find('td:first').text();
});
This says when you double click on any row in your table, find the first cell of that row, and store its text value in a variable.
Ondoubleclick of a row in grid call a function.
Use the below lone of code to get the selected row id (primary key of row) and then get the row contents using that id and then get the column content using the column name. Once you have the country name, open whatever page you want based on country.
selId = jQuery("#myGrid").jqGrid('getGridParam','selarrrow');
alert("Selected Id is ->"+selId);
var data = jQuery("#myGrid").jqGrid('getRowData',selId);
alert("Status ->"+data.country);
本文标签: javascriptjqGrid HOWTO Get the value of specific cell upon double click on rowStack Overflow
版权声明:本文标题:javascript - jqGrid HOWTO: Get the value of specific cell upon double click on row - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745604117a2665739.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论