Forum

July 12th, 2025
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
Add button inline form
02/12/2009
11:05
Avatar
Cyril
Guest
Guests

Hi folks,

I'am able to add a custom button in grid pager, but not in edit Inline form.

Help would be appreciate.

Regards.

02/12/2009
16:10
Avatar
Cyril
Guest
Guests

Sorry to ask again... I'm really stuck Embarassed

02/12/2009
16:41
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Could you please look at demo page - section Row editing

Another possibility is to use custom formater

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.

02/12/2009
17:03
Avatar
Cyril
Guest
Guests

Oh, I know demo page like my pocket. I read everything to learn tu use this great framework.

But this demo doesn't help as I'm trying to add a custom button (to add a duplicate fonction) in the edit form itself. Not in the grid. You know, before the "submit" button, I would like to have my custom button: duplicate.

02/12/2009
17:09
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Inline editing (as you say in first post) is diffrent from form editing.

You can use onInitializeForm event to add a custom button in the form something like:

onInitializeForm : function (formid)

{

$(”.EditButton”,formid).append(append here your button);

// bind click to the botton here

}

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.

02/12/2009
17:11
Avatar
Cyril
Guest
Guests

Millions a thanks! I going to try that right now.

02/12/2009
18:14
Avatar
Cyril
Guest
Guests

It's almost ok !

Here's the code

onInitializeForm : function(form_id) {
     var bC  ="<input id=\\"cData\\" type=\\"button\\" value=\\"Copy\\"
onclick=\\"duplicateSample();\\"/>";                   
     $(".EditButton",form_id).append(bC);
...

where duplicateSample() display only an alert('hello Tony');

The funny thing is my original submit and close button don't work anymore. I can saw them, but close doest close the form.

                       

02/12/2009
18:24
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Give the button diffrent id as of cData -  eg. ccData or something else

These cData, pData, nData, sData - are defined before in the form

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

03/12/2009
10:25
Avatar
Cyril
Guest
Guests

Many thanks again Tony for your help.

It's almost working. Here's the code.

$(”#defineSample”).navGrid('#pagerDefineSample',
    {edit:true,add:true,del:true,search:false,refresh:true},
    {
       editCaption: “Edit Sample”,
       (…)   
        },

    onInitializeForm : function(form_id) {
      var bC  =”<input id=\\”ccData\\” class=\\”EditButton\\” type=\\”button\\” value=\\”copy\\”  onclick=\\”duplicateSample()\\”>”
      $(”.EditButton”,form_id).append(bC);
    (…)                   
    }
           

function duplicateSample(){
       
  var idSample = jQuery(”#defineSample”).getGridParam('selrow');
  var id = jQuery(”#defineSample”).getGridParam('selrow');
                   
  if (id) {                       
    //on recupere les données de la ligne selectionnée
    var idSample = $(”#defineSample”).getRowData(id);
    $.ajax({
      type: “POST”,
      url: “include/ajax/smplDuplicate.php5?sampleId=”+id+”&requestId=”+document.getElementById('reqId').value,
      data: “sampleId=”+id,
      success: function(msg){
      $(”#defineSample”).trigger(”reloadGrid”);
    }                       
  );//if id                                               
  } else {
    errorMsg('Please, select a sample to duplicate first!');
}

                   
        }

           

There's still something wrong as it works on Firefox but not on IE.

I'm loosing Close and Submit actions on IE and the form doesn't open easily, as Firefox. Funny…

03/12/2009
14:00
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Try NOT TO ADD class EditButon for the input element. We already have it.

      var bC  =”<input id=\\”ccData\\” class=\\”EditButton\\” type=\\”button\\” value=\\”copy\\”  onclick=\\”duplicateSample()\\”>”
      $(”.EditButton”,form_id).append(bC);

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
43 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