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

[DT] Fix #1010. Update to data's new length when data is changed. #1011

Merged
merged 6 commits into from Aug 31, 2013

Conversation

Projects
None yet
2 participants
@apipkin
Copy link
Contributor

apipkin commented Jul 20, 2013

When data is updated on the DataTable, Paginator isn't updated to the new totalItems. This causes an issue when the last page button is pressed.

This fix updates the Paginator's totalItems when the DataTable's data is updated. Issue #1010

  • Test
  • Code Fix
  • History
  • Sign Off or 3 days
@@ -586,6 +586,8 @@ Y.mix(Controller.prototype, {
var data = this.get('data'),
model = this.get('paginatorModel');

model.set('totalItems', data.size());

This comment has been minimized.

@ericf

ericf Jul 23, 2013

Member

It seems this method get's invoked when the dataChange event fires. What defines the data attribute? And can't the size change when data is added or removed from the list? It also doesn't seem to be common for the entire list to change from once list instance to a different one.

This comment has been minimized.

@apipkin

apipkin Jul 25, 2013

Contributor

I found this when doing a lazy load of the data. data is the modelList of the DataTable. This was not in place and needs to be set so that when the data of a DataTable has changed after instantiation, the paginator gets updated if that size changes. The test that was updated is also a good indication of this data size changing.

@ericf

This comment has been minimized.

Copy link
Member

ericf commented Jul 31, 2013

Can you add a test to see if the paginator's totalItems attribute is updated when items are added/removed from the datatable?

@apipkin

This comment has been minimized.

Copy link
Contributor

apipkin commented Aug 14, 2013

@ericf Tests have been added, as well as code in the paginator to address these updates. Thanks!

@apipkin apipkin merged commit 5d76a66 into yui:dev-master Aug 31, 2013

1 check was pending

default The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment