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

Move to first page after rows is updated #12

Merged
merged 3 commits into from
Dec 18, 2014

Conversation

cmbankester
Copy link
Contributor

No description provided.

@cmckni3
Copy link
Collaborator

cmckni3 commented Dec 18, 2014

Should probably adjust the code to be tailored towards this edge case.

When rows is replaced with a new array that is shorter and you're on a page after the new pages length, the table needs to go to a page of the new dataset.

@cmbankester
Copy link
Contributor Author

Ah, yeah, I can see that being an issue. I'm worried it'll be strange if you push or remove a record to/from the rows array and it sends you back to the first page.

What if we extended the DataTable API with a addRecord and removeRecord function that doesn't mess with the current page, and a replaceRows function that does?

@cmckni3
Copy link
Collaborator

cmckni3 commented Dec 18, 2014

Yeah it would be jarring to have the page automatically change. I like the idea of extending the API.

@cmbankester
Copy link
Contributor Author

@cmckni3 How's that?

@cmbankester
Copy link
Contributor Author

There, that should be good. So now, if you want to reset the rows and have it automatically reset to the first page, just call table.replaceRows(array_of_new_rows). And if you want to push/pop rows, you can now call table.addRecord(new_row) and table.removeRecord(current_row)

@cmbankester
Copy link
Contributor Author

We should probably work on getting some API docs on the github repo / demo page.

@cmbankester cmbankester merged commit a2aa3d8 into releases/0.5.0 Dec 18, 2014
@cmckni3
Copy link
Collaborator

cmckni3 commented Dec 18, 2014

Looks good

@cmckni3 cmckni3 deleted the hotfix/reset-page-on-array-update branch December 23, 2014 23:51
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.

2 participants