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_Related Related Topics sp_TopicIcon
beforeSubmit not firing
24/07/2012
19:15
Avatar
Felipe @ kWhOURs
Member
Members
Forum Posts: 3
Member Since:
24/07/2012
sp_UserOfflineSmall Offline

I have spent a while tryign to figure out why it is that the beforeSubmit event is not firing whenever I submit a new element or an update to my server. I get the request with all of the information from the form but beforeSubmit does not get called before hitting the server (I can tell because postdata is not modified and because I hvae a linebreak when it reaches that line of execution).

Below is the code for this grid:

              jQuery("#typeMetadataGrid").jqGrid({

                  datatype: "json",

                  colNames:['Id','Label','Order'],

                  colModel:[

                           {name:'id',index:'id', width:55,editable:false,editoptions:{readonly:true,size:64}},

                           {name:'label',index:'label', width:200,editable:true,editoptions:{size:64}},

                           {name:'displayOrder',index:'displayOrder', width:55,editable:true,editoptions:{size:5}}

                     ],

                     onSortCol : function(index, iCol,sortorder) {

                           jQuery("#typeMetadataGrid").jqGrid('setGridParam', {loadonce:true, sortable: true });

                           return "";

                     },

                     jsonReader : {

                           root:"typeMetadatas",

                           page: "currentPage",

                           total: "totalPages",

                           records: "totalRecords",

                           repeatitems: false,

                           id: "id" },

                     closeAfterEdit:true,

                     closeAfterAdd:true,

                     reloadAfterSubmit:true,

                     rowNum:20,

                     mtype:'POST',

                     rowList:[10,15,20,25,30,35,40],

                     pager: '#navGridMetadata',

                     sortname: 'displayOrder',

                     sortorder: "desc",

                     loadonce:true,

                     sortable: true,

                     height: 310,

                     viewrecords: true,

                     caption:"Example",

                     editurl:'${metadataChanged}',

                                  beforeSubmit: function(postdata, formid){

                                         postdata.typeMetadataGroupId = typeMetadataGroupId;

                                         return [true,""];

                                  }

              });

Anyone have any ideas why my beforeSubmit function is not getting called?

26/07/2012
01:08
Avatar
Felipe @ kWhOURs
Member
Members
Forum Posts: 3
Member Since:
24/07/2012
sp_UserOfflineSmall Offline

Not very impressed with this community. This was pretty simple to solve and no one made anything close to a suggestion.

           function addRow(){

              $("#typeMetadataGrid").jqGrid('editGridRow',"new",{width:350, reloadAfterSubmit:true, closeAfterAdd: false,

                                              onclickSubmit:function(params, postData){

                                                   postData.typeMetadataGroupId = typeMetadataGroupId;

                                                        return postData;

                               }});

           }

So the answer is that you need to be adding these events to editGridRow not directly onto the grid. Really obvious if you know the apis. I can see how the documentation states this but it is somewhat unclear. It feels like the community could help build examples there to be useful. 

26/07/2012
01:10
Avatar
Felipe @ kWhOURs
Member
Members
Forum Posts: 3
Member Since:
24/07/2012
sp_UserOfflineSmall Offline

One more thing for anyone using this for the first time if you are interested in adding postdata to edit  you can also do this by doing something like this

                     var gr = jQuery("#typeMetadataGrid").jqGrid('getGridParam','selrow');

                     if( gr != null ){

                           jQuery("#typeMetadataGrid").jqGrid('editGridRow',gr,{width:350, reloadAfterSubmit:true, closeAfterEdit:true,

                                  onclickSubmit:function(params, postData){

                                                postData.typeMetadataGroupId = typeMetadataGroupId;

                                                return postData;

                                         }});

                     }

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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