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

Extend fnAddTr to allow updating an existing TR node instead of adding #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chmielot
Copy link

@chmielot chmielot commented Feb 2, 2013

Use case is the following:

Given a DataTable with an actions column. One of the actions changes the row's data via ajax, so that the row actually changed. The ajax request returns a freshly rendered row for the changed entity. To not reload the whole table and lose current filter, pagination or any other settings, the row should be updated.

fnAddTr only allows to add new rows. This patch adds a parameter which can be a TR node or an index, like described in the fnUpdate API. If this parameter is set, the passed node will be updated with the new one.

I'm just not sure if extending fnAddTr is the best idea. Alternatives are:

  1. Rename fnAddTr to something more descriptive
  2. Instead of modifying fnAddTr, add a new plugin fnUpdateTr. That'll mean code duplication, as the code would be nearly the same as fnAddTr.

What do you think?

…ead of adding a new TR to the DataTables table.
@DataTables
Copy link
Collaborator

I think the update option might be better in an fnUpdateTr plug-in?

DataTables 1.10 is going to include an 'invalidate' method so you'll be able to update the DOM directly and then call invalidate() on the row/column/cell and have DataTables re-read the stored information, which sounds relevant here (although not yet implemented, so not yet massively useful!)

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