PDA

View Full Version : [CLOSED][3.0] PagingToolbar displayMsg issue



mschwartz
15 Apr 2009, 1:02 PM
In config for a paging toolbar:

displayMsg: 'Displaying items {0} - {1} of {2}',

the toolbar displays on the screen:

"Displaying items 01-025 of 967"

Why the leading zeros? This is new behaviour in 3.0 (there were no leading zeros in 2.x)

evant
15 Apr 2009, 1:07 PM
Can't confirm, see this example: http://extjs.com/deploy/ext-3.0-rc1/examples/grid/paging.html

mschwartz
15 Apr 2009, 1:09 PM
Does it inside an Ext.Window with a grid inside and Saki's PageSizePlugin but not in a tabpanel (with the plugin).

neat!

evant
15 Apr 2009, 1:10 PM
So can we assume this isn't an Ext bug?

mschwartz
15 Apr 2009, 1:15 PM
I wouldn't close this yet. The plugin works on dozens of other grids I have just fine - I don't think it's the problem.

EDIT: It rendered proper in 2.x.

evant
15 Apr 2009, 1:25 PM
Right, but it's just using String.format(), which hasn't changed. Please provide a test case.

mschwartz
15 Apr 2009, 1:25 PM
I'm sure it's an Ext bug.

I commented out the plugin and it still happens.

Here's the code:


bbar: new Ext.PagingToolbar({
store: ds,
loadMask: {
msg: 'Loading Asset List...'
},
pageSize: pwp.assets.grid_page_size,
plugins: new Ext.ux.PageSizePlugin(),
displayInfo: true,
displayMsg: 'Displaying items {0} - {1} of {2}',
beforePageText: 'Page',
emptyMsg: "Nothing to display"
}),


This is the bbar of an Ext.Window, not of the grid. I have something else as the grid's bbar.

Again, this worked in 2.x

evant
15 Apr 2009, 1:29 PM
Yes, but you can see in the example that it's not putting a leading 0, which is why I'd like to see a reproducible test case, otherwise I can't fix the issue.

mschwartz
15 Apr 2009, 1:33 PM
I seriously doubt this is going to help you.

proprietary code removed

mschwartz
15 Apr 2009, 1:36 PM
I think whatever variables inside the PagingToolbar that are formatted by {0} and {1} are '01' and '025' (strings)

I'm not overriding anything in PagingToolbar class, either.

evant
15 Apr 2009, 1:37 PM
No, not really, since I can't run it. I'm reasonably sure it isn't a bug in Ext, in the official examples the behaviour isn't there, it's much more likely you have an override or extension somewhere that is causing this issue.

mschwartz
15 Apr 2009, 1:40 PM
No, not really, since I can't run it. I'm reasonably sure it isn't a bug in Ext, in the official examples the behaviour isn't there, it's much more likely you have an override or extension somewhere that is causing this issue.

I hate to argue with you but a handful of examples don't prove there's no bug. It's there, and my code is certainly doing things differently than some simple example. Like putting the paging toolbar as the bbar of the window and not the grid is likely a difference from the examples.

I'd really rather you focus on fixing the urlEncode bug though. That's really serious. This is cosmetic.

evant
15 Apr 2009, 1:45 PM
Agreed, however I haven't seen an example that doesn't work either, so it'd be great if you could give me a sample that I could run that shows this bug.

mjlecomte
15 Apr 2009, 7:11 PM
I seriously doubt this is going to help you.

proprietary code removed

Sorry, but if you want someone to provide a fix, you need to provide working code that shows the problem.

use one of the demos as a base and modify it to reproduce the problem.

mschwartz
16 Apr 2009, 4:53 AM
I will do better. I'll find the line in the Ext 3.0 sources that is the problem by debugging through the code.

I can reproduce the problem here 100% of the time.

evant
16 Apr 2009, 4:59 AM
Just FYI I've been checking with a few people here at the conference that are using Ext3 and the PagingToolbar, they aren't having any issues with it.

mschwartz
16 Apr 2009, 5:05 AM
Here's a progress report.

Breakpoint in updateInfo after the datastore is loaded first time

this.cursor = '0'

it should be

this.cursor = 0

It's a javascript gotcha that '0' + 25 is '025'

this.totalLength = 967 (proper/good value)

mschwartz
16 Apr 2009, 5:11 AM
in onLoad()

o.params.start = "0"
o.params.limit = 25

mschwartz
16 Apr 2009, 5:16 AM
It is a problem related to the urlEncode bug I reported yesterday and the lack of parseInt() around data you might receive via json encoded strings (at least in PagingToolbar).

The fix I suggest for this bug, which will bite people, is:

PagingToolbar.js, line 303


this.cursor = (o.params && o.params[this.paramNames.start]) ? o.params[this.paramNames.start] : 0;


should be:


this.cursor = (o.params && o.params[this.paramNames.start]) ? parseInt(o.params[this.paramNames.start]) : 0;

mschwartz
16 Apr 2009, 5:20 AM
Per above, you probably should do parseInt() in a lot more places throughout, especially when dealing with json encoded data. If people are using php and querying values from a database or reading them from files, they're going to be encoded by json_encode() as strings.

mschwartz
16 Apr 2009, 5:20 AM
And I can now trivially reproduce the issue using one of the demos if you like. :)

evant
16 Apr 2009, 6:31 AM
Sure, but this isn't a bug. If you're passing a string, then it's not a valid start/limit parameter. We might add some sanity checks in future, however I'm closing this off for now.

Note that this behaviour hasn't changed from 2.x to 3.x.

rainmaker
16 Feb 2010, 1:37 PM
My display message is shown as:

Displaying 1 - 2066 0f 2066

I have not overriddent the displayMsg of the PagingToolbar. My page size is 500 so when I page forward, it adds 500 on the display -- Displaying 501 - 2566 of 2066.

Can anyone help?

Jamie Avins
16 Feb 2010, 1:45 PM
If you believe you have a bug, please enter a new report and supply a runable test case so we can address it.