Forum


18:08

16/04/2009

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();
...
})
03:41

Moderators
30/10/2007

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.
09:49

16/04/2009

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.
10:14

16/04/2009

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.
12:51

07/06/2009

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;
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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66