Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SAMPLE] simulate pagination bug when adding new row #511

Closed
wants to merge 1 commit into from

Conversation

gratex
Copy link

@gratex gratex commented Mar 27, 2013

pagination extension is not being notified about adding new item into observable store in the case when item should be inserted into the next page.

The root of this problem seems to be inside dojo/store/Observable
https://github.com/dojo/dojo/blob/master/store/Observable.js#L103

Variable insertedInto equals -1 which prevents notifying listeners (in this case pagination extension) about changes and therefore grid will not update total count of items neither page links. User can not see new rows, because these rows are on the other page, however link to the other page was not created... User will see new rows only in the case, when other notification was fired (sort, delete, etc).

We have added simple testcase where you can try it. Just create more than three rows.
When you comment out line 103 in Observable store, it seems to be working correctly.

	dGrid's pagination plugin is not being notified about adding new item
	into observable store in the case when item should be inserted into next page.
@runtarm
Copy link

runtarm commented Apr 4, 2013

I think dojo/store/Observable is doing the right thing.

The problem is the dgrid observe only items in the range that got rendered, which is just work for OnDemandGrid.
Pagination, in the other hand, doesn't work that way. The whole store should be observed instead.

Btw, the Pagination should be mixed with normal Grid not the OnDemandGrid.

@kfranqueiro
Copy link
Contributor

This has generally been resolved in dgrid 0.4 thanks in part to dstore's notification events facilitating easier tracking of the store's total length, but in testing right now I noticed that dgrid 0.4.0 actually has an off-by-one error (e.g. page 2 only gets added when the 5th item is added, not the 4th).

I have a potential fix that I'll push a branch for shortly and hopefully get merged sometime soon, to be included in 0.4.1.

FWIW this can be tested quickly via test/extensions/Pagination.html by typing grid.collection.add({}); in the console.

@kfranqueiro
Copy link
Contributor

Off-by-one issue fixed in 4b35dc7 (master) and 7aae46c (dev-0.4).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants