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
How to activate the Form Edit from custom input button
04/02/2010
20:10
Avatar
Meng Hai
Member
Members
Forum Posts: 17
Member Since:
03/02/2010
sp_UserOfflineSmall Offline

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'/>&nbsp;&nbsp;&nbsp;&nbsp;");

Now what should I do if I wanted to activate the Form for Editing?

$("#buttEdit","#t_griddetail").click(function(){
 
});

Thanks.

05/02/2010
06:01
Avatar
Meng Hai
Member
Members
Forum Posts: 17
Member Since:
03/02/2010
sp_UserOfflineSmall Offline

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 elseCool

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information