Forum


20:10

03/02/2010

Firstly bec I do not know how to dynamically enable/disable the Edit button in the navGrid toolbar, I thought of creating my own buttons in a new Toolbar. I am able to enable/disable my custom buttons depending on the selected row. But how to I activate the Form Edit to simulate a click of the Edit button in the navGrid toolbar?
Better still if someone can tell me if dynamically enable/disable the Edit button in the navGrid toolbar is possible, and if so how to go about it.
I did this:
toolbar: [true,"top"]
And I check my row record with this:
onSelectRow: function(ids) {
var ffs = $('#griddetail').jqGrid('getCell', ids, "Confirmed");
if (ffs==1){
$("#buttEdit","#t_griddetail").attr("disabled",true); //if record is confirmed - do not allow editing
}else{
$("#buttEdit","#t_griddetail").attr("disabled",false);
}
}
Then added this:
$("#t_griddetail").append("<input type='button' value=' Edit ' disabled=true id='buttEdit' style='height:20px;font-size:-3'/> ");
Now what should I do if I wanted to activate the Form for Editing?
$("#buttEdit","#t_griddetail").click(function(){
});
Thanks.
06:01

03/02/2010

Found it.
for Add:
jQuery("#griddetail").jqGrid("editGridRow","new");
for Edit:
jQuery("#griddetail").jqGrid("editGridRow","idno"); //replace "new" with record id no eg "2"
for Delete:
jQuery("#griddetail").jqGrid("delGridRow","idno");
Eg of use in Delete button:
$("#buttDelete","#t_griddetail").click(function(){
var s;
s = jQuery("#griddetail").jqGrid('getGridParam','selrow'); //get the selected record no
if (s==null){
alert("Please select a record.");
}else{
jQuery("#griddetail").jqGrid("delGridRow",s,{reloadAfterSubmit:true,jqModal:false, closeOnEscape:true});
}
});
hope this help someone else
Most Users Ever Online: 715
Currently Online:
89 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