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
NaN as total number of pages for JSON/XML data with 0 rows
21/09/2010
18:07
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hi Tony!

In jqGrid 3.7.2 the lines 1098 and 1239 of grid.base.js should be fixed from 

    if(locdata) {

to

    if(locdata && rn) {

because in case of JSON/XML data rn and len will be undefined. And as a result if loadonce:true one will see http://www.ok-soft-gmbh.com/jq.....oData0.htm. After the fixes the empty grid looks like http://www.ok-soft-gmbh.com/jq.....oData1.htm.

The problem with jqGrid 3.8 in MUCH MORE hard. You inserted line 1196

    if (!drows) { return; }

after

drows = $.jgrid.getAccessor(data,dReader.root);

which is wrong. Some initializations like 

    if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }

and

    if (!more) { ts.updatepager(false,true); }

and probably

    ts.p.treeANode = -1;

must be done. In the current version of  jqGrid 3.8 updatepager() will not called the pager will not filled and gridComplete will not called at all.

Best regards
Oleg

24/09/2010
09:23
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Oleg,

Thanks. I think that the lines in 3.8 are OK, since you missed in the response the empty array. - i.e in your example we have

{"page":1, "records":0, "total":1}

but I think it should be

{"page":1, "records":0, "total":1, rows:[]}

What do you think?

Kind regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

24/09/2010
11:51
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony,

You are right, this is a workaround. In the question which initialized my post here it was used as a solution. I posted this problem here because I look at the problem from a little other side.

It seems to me the problem which appears once will appear next time for other users. It would be better if one make jqGrid code a little more robust in case of missing some input information. I mean that it would be nice if jqGrid be able to display empty table not only for

{"page":1, "records":0, "total":1, rows:[]}

but also for

{"page":1, "records":0, "total":1}

{"page":0, "records":0, "total":0}

{"records":0}

or

{}

The most part of codes use already default values for missing input parameters. For example you use

    ts.p.page = $.jgrid.getAccessor(data,dReader.page) || 0;
    lp = $.jgrid.getAccessor(data,dReader.total);
    ts.p.lastpage = lp === undefined ? 1 : lp;
    ts.p.records = $.jgrid.getAccessor(data,dReader.records) || 0;
    ts.p.userData = $.jgrid.getAccessor(data,dReader.userdata) || {};

so you tried already to make the code working for undefined input data. The change of the code

    drows = $.jgrid.getAccessor(data,dReader.root);
    if (!drows) { return; }

to one line

    drows = $.jgrid.getAccessor(data,dReader.root) || {};

seems for me the best pragmatic solution of the problem which just follow the other parts of code.

Best regards
Oleg

12/10/2010
10:28
Avatar
susam
China
New Member
Members
Forum Posts: 1
Member Since:
12/10/2010
sp_UserOfflineSmall Offline

Hi OlegK,

I got a problem like this,

http://dl.javaeye.com/upload/p.....2e53ec.jpg

when the total records is less than 1000, it works good; But it doesn't work  more than 1000 (not exact figures) like below:

http://dl.javaeye.com/upload/p.....6bceab.jpg

<?xml version ="1.0″ encoding="utf-8″?>

<rows>
  <page>${page}</page>
  <total>${totalPages}</total>
  <records>${records}</records>
    <#list attendances as att>
    <row id ="${att.id.bh}">
      <cell>${att.id.bh}</cell>
      <cell>${att.xm!}</cell>
      …
    </row>
    </#list>
</rows>

jqGrid version is 3.8!


Best regards!

Ken

Sorry, I found the reason, because I make the number as string!

23/10/2010
12:28
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello Oleg,

Also fixed.

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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