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
Open a JQuery Tab from a clickable column within jqgrid
18/07/2012
09:47
Avatar
shivam
New Member
Members
Forum Posts: 2
Member Since:
18/07/2012
sp_UserOfflineSmall Offline

Hi,

In my ui i have 2 tabs, In the fist tab i am disolaying a jqgrid which has one clickable column. On click of this column, i need to open the second tab. 

Appriciate if any one can show me some direction.

18/07/2012
12:22
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

20/07/2012
09:00
Avatar
shivam
New Member
Members
Forum Posts: 2
Member Since:
18/07/2012
sp_UserOfflineSmall Offline

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>

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information