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
Where to sdd a click function for a href link
15/04/2009
18:08
Avatar
binchen
Member
Members
Forum Posts: 8
Member Since:
16/04/2009
sp_UserOfflineSmall Offline

I added <a href> to my cells in afterInsertRow as:jQuery(

"#gridReferralConsultList").setCell(rowid, "HCPRequesting", "<a href='#dialog' name='modal'>" + aData.HCPRequesting + "</a>");

I would like to know how can I add click function like the following,

My code and click function works if the <a href> link is outside jqGrid.

$('a[name=model]').click(function(e) {

e.preventDefault();

...

})



16/04/2009
03:41
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

You can add click in afterInsertRow too. Just after setCell add this and it will work.

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.

16/04/2009
09:49
Avatar
binchen
Member
Members
Forum Posts: 8
Member Since:
16/04/2009
sp_UserOfflineSmall Offline

Thanks,

It works, however it will add to each and very single row. When my requirement needs to display 250 rows, it just a way too slow when my click function needs to retrieve data from Database.

Any way I can add the click function for <a href> to the whole grid then pass on to each cells? May be an enhencement for consideration?

Thanks again.

16/04/2009
10:14
Avatar
binchen
Member
Members
Forum Posts: 8
Member Since:
16/04/2009
sp_UserOfflineSmall Offline

I know why it is so slow now.

When you add after setCell in afterInsertRow for 250 rows, It actually attached click function 250 times for the first row (We can do math for other row).

The correct place is in "gridComplete: function() { }"

Thanks again, your suggestion still led to solve my problem.

07/06/2009
12:51
Avatar
swhit
Member
Members
Forum Posts: 3
Member Since:
07/06/2009
sp_UserOfflineSmall Offline

A better way to do this might be to create this link on the PHP (server side) so it offloads the work onto the server and the info is already there for the jqgrid. Here is an example for an XML data return (please note the “htmlentities” in the php code):

foreach ($result as $key => $value) {

$html .= “<row id='”. $value['id'].”'>”;            

$link = “<a href='#' onclick='some_function(\\”" . $value['id'] . “\\”);'>Here is a Link</a>”;

$html .= “<cell>” . htmlentities($link) . “</cell>”;

$html .= “</row>”;

}

return $html;

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