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
rowNum and resetting grid
Tags: rowNum
05/01/2011
22:44
Avatar
brg07003
New Member
Members
Forum Posts: 2
Member Since:
05/01/2011
sp_UserOfflineSmall Offline

I am having an issue with resetting the search filter on a grid when the rowNum is set to -1. I have a loadonce grid that receives json data then works completely on the client side. Part of its functionality involves programmatically applying a filter to it. To apply the filter I wrote the following method:

function searchGrid(gridId, field, string) {

    var grid = $('#' + gridId);

    var postdata = grid.jqGrid('getGridParam', 'postData');

    $.extend(postdata,

        { filters: '',

           searchField: field,

           searchOper: 'eq',

           searchString: string

          });

   grid.jqGrid('setGridParam', { search: true, postData: postdata });

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

}

The function for clearing the filter on a grid is as follows:

 function resetGrid(grdName) {

 var grid = $('#' + grdName);

 grid.jqGrid('setGridParam', { search: false });

var postData = grid.jqGrid('getGridParam', 'postData');

$.extend(postData,{searchField:"",searchString:"",searchOper:""});

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

When I set the rowNum option for the grid to a number, the above works as expected. When I set rowNum to -1, the grid initially contains all of the rows (as expected). But when I try to search the grid or reset it, it shows the correct rows but one is chopped off. For example, say the grid pull back 10 rows. Before I use either of  the above methods, the grid has 10 rows. If I call the reset method, the grid now has 9 rows (instead of 10). If I perform a search that should retrieve 1 result, the grid is empty (should show the 1 result).

05/01/2011
23:26
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

The usage of rowNum equal to -1 or other negative value is wrong and not supported (at list for local jqGrid data). If you look at the documentation you can see that the sentance about -1 value is removed. You can use any large value instead (1000, 10000), but it is strictly recomended to use small values of rowNum which follows to data pagination. It is much more effective and comfortable for the user. No display can show 1000 rows at once. Scrolling of data inside web browser is less effective as jqGrid pagination. Moreover no real person are able to read and analyse so many information items. The usage of toolbar searching, advance searching and other searching possibilities of jqGrid could provide together with the local pagination the best user expirience.

Best regards
Oleg

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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