Forum


12:22

Moderators
30/10/2007

Hello
Please look for the events in jqGrid documentation.
It is too common when I click on the column -
what you mean with column - column data or column header - that are different things.
Best Regards
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.
09:00

18/07/2012

Thanks, i was able to resolve this. Yes, i wanted a link within grid column data. On click of this link, second tab should open.
Just in case others have the same requirement, this is how i did it,
1. Add a custom Link format to the column data which should be a Link so that we add an ID into the anchor
2. Make use of onCellSelect to handle the cell select event.
2.1 Check if the cell clicked is the linkable column
2.2 If so, bind anchor (using ID) to click event and handle it (invoke the second tab)
<script type="text/javascript">
// JQGrid
jQuery("#list2").jqGrid({
$(document).ready(function() {
.......
colModel: [
{name:........}, // Normal Column
{name:'object_name',index:'object_name', width:205, sorttype:'text', edittype:'select', formatter:linkFmatter},
// Custom link formater to add ID into anchor tag
......
onCellSelect: function (rowid,iCol,cellcontent,e) {
var cm = jQuery("#list2").jqGrid('getGridParam','colModel');
if (cm) {
var colName = cm[iCol].name;
if(colName == 'object_name') {
var changeTab = function(ev){
ev.preventDefault();
var tabIndex = this.hash.charAt(this.hash.length-1) -1;
$tabs.tabs('select', tabIndex);
return false;
}
$('#linkclass').bind('click', changeTab);
$('#linkclass').click();
}
}
}
...
}
</script>
<script type="text/javascript">
function linkFmatter(cellvalue, options, rowObject) {
return "<a href='#fragment-2' id='linkclass'><B>"+cellvalue+"</B></a>";
}
</script>
Most Users Ever Online: 715
Currently Online:
44 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