Forum
23:08
02/05/2013
I have been asked to put buttons inside a jqGrid, but they will not be used for editing the contents of the grid. They will be a submit button that will sit at the end of each row, and will be greyed out/disabled until the onSelectRow fires.
Based on a couple examples I have found, I'm able to create the buttons as follows:
var ids = $("#myGrid").jqGrid("getDataIDs");
for (var i=0;i < ids.length;i++) {
var cl = ids[i];
sm = "<input style='height:25px;width:65px;' type='submit' value='Re-Send' onclick="$('#myGrid').editRow('"+cl+"');" />";
ca = "<input style='height:25px;width:55px;' type='button' value='Cancel' onclick="$('#myGrid').editRow('"+cl+"');" />";
$("#myGrid").jqGrid("setRowData",ids[i], {msgAct:sm+ca});
}
The text in red above I know won't be in my code, I'm only using it as a placeholder right now. Also, the code is in the loadComplete event. The buttons are being created, but I'm lost as to how to disable them within the for loop.
What I need to do is the following:
- Once each of the 2 buttons (in the Action column) has been created, I need to disable both of them. How do you do this inside the jqGrid programatically?
- In the onSelectRow event I'll get the row data I need, and want the Re-Send & Cancel buttons to become active on that row only.
- Within the onSelectRow event is where I will look for the click event for the two submit buttons for that row.
- Until the row is selected, the buttons should be disabled.
Also, should the 2 buttons on each row be disabled in the loop, or after it finishes?
Thanks!
Most Users Ever Online: 715
Currently Online:
57 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