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
Support an "All" option for the rowList parameter
03/03/2010
09:53
Avatar
dw
Member
Members
Forum Posts: 8
Member Since:
07/06/2009
sp_UserOfflineSmall Offline

I typically configure the rowList option for all grids in our application with the following value:

properties.rowList = [10,20,50,100,'All'];

This allows users to display all items without putting a hard limit on the number of rows.  Although the rowList option doesn't explictly say that it requires an array of numeric values, there are several places in the code that assume rowNum will be a number.  It seems more of these have been added over time.

In jqGrid 3.4, I was able to use the rowList above with no changes to the the jqGrid code and I did not receive any errors.  Upon upgrading to jqGrid 3.5 I had to make the following slight modification to the updatepager method, but this approach still worked. 

updatepager =

function(rn) {

var cp, last, base,bs, from,to,tot,fmt;

if(isNaN(ts.p.rowNum)){

   base = 0;

}

else{

   base = (parseInt(ts.p.page)-1)*parseInt(ts.p.rowNum);

}

 

With the upgrade to 3.6, it appears that there are more places in the code that would need to be updated. 

Would it be possible to do one of the following:

1) add code to support nonnumeric value for rowList option (this seems like it would be harder and possibly less desirable)

OR

2) add another parameter rowListLabels or something like this or another mechanism that would allow the label for the select options to be set.  This would allows us to specify an arbitrary high number like 1000000 and give it the label of 'All' (this seems like an easy change)  Of course, I could write some code to go set this label manually after the pager is rendered, which is what i will probably do in the short term, but i thought i would throw it out there as a possible enhancement. 

Thanks for considering the change.

15/09/2011
12:34
Avatar
boogey100
Member
Members
Forum Posts: 10
Member Since:
28/04/2010
sp_UserOfflineSmall Offline

Perhaps allowing it to be an object rather than an array would do it, so you could have { '10':10,'20':20,'50':50,'All':-1 }. My gues is the only thing that would need changing is the bit that builds the <select> in the pager.

15/09/2011
13:21
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello!

I agree with you. The same requirement have the most customers. The usage of "-1" is not allowed and can't be used, but one can use some large enough value and change the corresponding text value only for the user. For example I used mostly

rowList: [5, 10, 20, 50, 1000, 5000],
pager: '#pager' 

in the jqGrid definition and includes the following line after the grid creation:

$("#pager option[value=5000]").text('All');

It's a workaround, but it improves the visibility of the grid.

Best regards
Oleg 

24/01/2012
09:35
Avatar
fabamb
New Member
Members
Forum Posts: 1
Member Since:
24/01/2012
sp_UserOfflineSmall Offline

May I suggest an improvement?
Instead of setting an arbitrary value, which is always wrong, you can set as a sentinel value 0 for 'All' and manage server-side, correctly. On the other hand, often in paging systems, it works without having to do anything.

rowList: [5, 10, 20, 50, 1000, 0],
pager: '#pager

$("#pager option[value=0]").text('All');

24/01/2012
12:45
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello fabamb,

I don't think that one should include in the code of jqGrid any changes which break the current server code. Your suggestion require changes on the server side because the code SELECT TOP(0) will work not good. On the other side if you use "SQL Server Management Studio" for example it uses per default TOP(1000) in all your selects of the tables. It's good because mostly you will not look through all returened rows and examine only some first rows. So I think that the usage of some large enough value like 5000 will be better. One can include the value as a new jqGrid option together with the text 'All' and make it configuratable. In the way one will receive full flexibility, but still don't break existing server code. So all users can update to the new version of jqGrid without additional compatibility problems.

Best regards
Oleg 

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