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
Form edit: Save record on previous/next
24/08/2010
11:47
Avatar
Seroczynski
The Netherlands
Member
Members
Forum Posts: 17
Member Since:
10/02/2010
sp_UserOfflineSmall Offline

Hey all,

I've searched the forum with no succes, therefor I'm asking if anyone knows how I'd be able to make sure the following works.

I'd like to be able to save a record when the user uses one of the navigation buttons found at the lower-left bottom of the form edit (default settings). Now the user has to manually press the save button or else he/she will lose any changes that have been made to the record.

Thanks in advance for any help or hints toward the right directions ;)

Edit: I've found some more information at the Wiki, I'll be sure to check this out and reply with my findings.

24/08/2010
13:48
Avatar
Seroczynski
The Netherlands
Member
Members
Forum Posts: 17
Member Since:
10/02/2010
sp_UserOfflineSmall Offline

So I've found out I should use 'onclickPgButtons' and found a topic here where someone asks for an example and it seems to work for him (or her). However, I can't get it to work. Is there any place where I could get to see some kind of an example of some sort?

My current code:

... jqGrid definition ...

...

onclickPgButtons: function(which, formid, rowid) {
jQuery('#sData', formid).trigger('click');    
},

...

Is "#sData" a predefined parameter or value? Because in the example I got from the other topic it get's followed by the var 'formid'.

I'm starting to get confused and could use some help here, thanks in advance.

27/08/2010
17:50
Avatar
Seroczynski
The Netherlands
Member
Members
Forum Posts: 17
Member Since:
10/02/2010
sp_UserOfflineSmall Offline

I'm sorry to bump this thread, however I expected this to be a feature which wouldn't only benefit me. This would actually increase the fool-proofness of the entire jqGrid 🙂

01/09/2010
22:26
Avatar
psparta
Argentina
New Member
Members
Forum Posts: 1
Member Since:
01/09/2010
sp_UserOfflineSmall Offline

Estimados:

Con este pequeño cambio funcionó OK:

                    onclickPgButtons: function(which, formid, rowid) {
                            jQuery('#sData').trigger('click');
                    },

Saludos y gracias por el post.

02/09/2010
23:43
Avatar
Reg
Calgary, Canada
Member
Members
Forum Posts: 92
Member Since:
06/06/2008
sp_UserOfflineSmall Offline

It's not working for me –

First problem I had is that I added this event to the grid definition, not the modal form definition — once I had that fixed, things went better.

I've inserted an Alert() to tell me if the event is being called, and when I press enter on the next button, the alert message appears and I move to the next record. But there is no hit on my server to do a save.

My code looks like this:

var editprm = {
    jqModal: false,
    editCaption: "Edit a Student's Mark",
    top: 0,
    left: 50,
    width: 600,
    height: 400,
    onclickPgButtons: function (which, formid, rowid) {
        alert(which + " button clicked on " + formid );
        $("#sData",formid).trigger("click");
      },
    reloadAfterSubmit:true,
    closeAfterEdit:true
  };

The alert message is "next button clicked on [object Object]"

My grid definition is as follows:

   $("#tblmarks").jqGrid( {
      url: 'wc.dll?CMProcess~AjaxGet~&Data=Grades&Key=&Same=.F.&sk=30R0TFL6417744&sh=39',
      datatype: 'xml',
      colNames: ['Student','Mark','Seconds','Comments'],
      colModel: [{name:'member', sortable:false, width:150 },
        {name:'mark', sortable:false, editable:true, width:35 },
        {name:'timetaken', sortable:false, editable:true, width:55 },
        {name:'comments', sortable:false, editable:true, edittype:'textarea', editoptions:{rows:'8',cols:'60'}, width:300 }],
      height: 'auto',
      altRows: true,
      altclass: 'ui-priority-secondary',
      gridview: true,
      rowList:[10,25,50,100,999],
      page: 1,
      rowNum:999,
      loadui: 'block',
      viewsortcols: [true,'horizontal',true],
      hidegrid: false,
      caption: 'Enter Student Marks',
      editurl:'wc.dll?CMProcess~AjaxPut~&Data=Grades&sk=30R0TFL6417744&sh=39',
      loadError: function(xhr,st,err) {
        $("#tblmarksMessage").html("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText);
        },
      ondblClickRow: function(rowid) { $("#tblmarks").editGridRow(rowid,editprm);},
      loadComplete: function() {
        }
    }); 
    $("#tblmarks").navGrid('#tblmarksPager',{
        add:false,edit:true, edittext:'Edit',del:false,search:false,refresh:true
         },
        editprm, // edit
        {}, // add
        {} // delete
     )

Any idea what I am doing wrong?

Tony, can you help?

Thanks,

Reg

03/09/2010
00:54
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi Reg,

You can try to use

    $("#sData", "#"+frmtb+"_2").trigger("click");

instead of $("#sData",formid).trigger("click"); where frmtb is a string "TblGrid_"+gID, where gID is the id of your jqGrid. Because id of your grid is "tblmarks", then you cat try simulate saving with respect of

    $("#sData", "#TblGrid_tblmarks_2").trigger("click");

or

    $("#sData", "table.EditTable#TblGrid_tblmarks_2").trigger("click");

Best regards
Oleg 

05/09/2010
20:29
Avatar
Reg
Calgary, Canada
Member
Members
Forum Posts: 92
Member Since:
06/06/2008
sp_UserOfflineSmall Offline

Hello Oleg,

Thanks for your suggestion. That works for me, so I'm a happy camper again.

Reg

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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