Here, response is a JSON object returned from the server and it correctly contains a total field. When total is greater than zero, the navigator correctly shows something like showing page 9 of 1039 for 10396 records.
However, when total is zero, the navigator incorrectly shows showing page 1 of 1 for 1 records, which is incorrect, because neither is there any record nor is the first page being displayed.
I have traced the problem to the getTotalNumber method, which is coded as:
Naturally, when both this.model.totalNumber and attributes.totalNumber are undefined, or set to zero, this method returns 1. This is why the navigator incorrectly refers to 1 record and the first page.
I think that the getTotalNumber method should return zero when the total number of records is undefined or unknown.
I have the following code:
Here,
response
is a JSON object returned from the server and it correctly contains atotal
field. Whentotal
is greater than zero, the navigator correctly shows something likeshowing page 9 of 1039 for 10396 records
.However, when
total
is zero, the navigator incorrectly showsshowing page 1 of 1 for 1 records
, which is incorrect, because neither is there any record nor is the first page being displayed.I have traced the problem to the
getTotalNumber
method, which is coded as:Naturally, when both
this.model.totalNumber
andattributes.totalNumber
are undefined, or set to zero, this method returns1
. This is why the navigator incorrectly refers to 1 record and the first page.I think that the
getTotalNumber
method should return zero when the total number of records is undefined or unknown.