Forum



23:54

04/05/2010

-----------------------------------------------------------------------------------------------------------------------------------
Check here for the answer
http://stackoverflow.com/quest.....04#2774104
-----------------------------------------------------------------------------------------------------------------------------------
I'm trying to call a function in the onClick event of the button that is created during the gridComplete function..Loads OK…here's what the rendered html looks like for the button in the first row
<input type="button" onclick="deleteRow(9197113);" value="Delete" style="height: 22px; width: 70px;">
but when i click the button…the function is not called and firebug says….
deleteRow is not defined
How can I call a function, rather than having inline javascript,,,(which does work BTW, but I would like to call the function for readability and maintainability).
Below is the grid Complete portion of the jqGrid settings.
jQuery("#list").jqGrid({
………………….
gridComplete: function() {
var ids = jQuery("#list").jqGrid('getDataIDs');
for (var i = 0; i < ids.length; i++) {
var cl = ids[i];
de = "<input style='height:22px;width:70px;' type='button' value='Delete' onclick='deleteRow('" + cl + "' );' />";
jQuery("#list").jqGrid('setRowData', ids[i], { Delete: de });
}
}
………………….
});
Here's the deleteRow() function…
function deleteRow() {
alert("hit delete button");
// jQuery("#grid_id").jqGrid('delGridRow', row_id_s,options );
}
Most Users Ever Online: 715
Currently Online:
110 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