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
instead of just the grid, trigger("reloadGrid") refreshes the main page
07/04/2014
22:33
Avatar
KKP
New Member
Members
Forum Posts: 2
Member Since:
07/04/2014
sp_UserOfflineSmall Offline

//load the empty grid

jQuery("#customerResults").jqGrid({

datatype: 'local',

loadonce:true,

colNames:[ 'Address'],

colModel:[ {name:'addrLineTxt',index:'addrLineTxt', editable:false}],

autowidth:true,

height: 'auto',

rowList:[],

pgbuttons:false,

pgtext:null,

viewrecords: true,

pager: '#customerResultPager',

caption:"Customer Search Result",

shrinkToFit: true,

});

 jQuery("#customerResults").jqGrid('navGrid','#customerResultPager',{search:false, add:false, edit:false, del:false}, {}, { }, {}, {} );

//This is event for external form to refresh grid based on certain search criteria.

$("#customerSearchForm").submit(function (e) {

e.preventDefault();

$.ajax({

type:"post",

data: $('form:first').serialize(),

url: $('form:first').attr('action'),

success: function(response){

$('#customerResults').jqGrid('clearGridData');

$('#customerResults').jqGrid().setGridParam({ data: response.rows, datatype:'json', }); //Everything fine till this line. And response.rows has records.

$("#customerResults").jqGrid().trigger("reloadGrid", [{page:1} ]); } }); //This line causes the page to refresh so that Insted of grid with data I see the fresh grid. 

//I see 2 calls made to the server. one to post the result and another one the url of the page containing grid. If I comment trigger("reloadGrid"), I only see one call to server but the data is not refreshed on the grid.Yell

});

07/04/2014
23:49
Avatar
KKP
New Member
Members
Forum Posts: 2
Member Since:
07/04/2014
sp_UserOfflineSmall Offline

Haha found the solution myself:LaughCool

$("#customerSearchForm").submit(function (e) {

e.preventDefault();

$('#customerResults').jqGrid().setGridParam({

url: $('form:first').attr('action'),

postData: $('form:first').serialize(),

datatype:'json',

jsonReader : { root: "rows", page: "page", total: "total", }

}).trigger("reloadGrid", [{page:1} ]);

});

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