Skip to content

[Feature Request] rows.clear method #440

@dday9

Description

@dday9
  • I have looked through the documentation to try to see if this feature already exists.
  • I have looked at the demos to see if one of them does what I want, but none of them did.

Is your feature request related to a problem? Please describe.
I dynamically populate my table via AJAX requests. A typical workflow is:

  1. A user searches a form
  2. This sends an AJAX request to fetch the filtered data
  3. The table should reflect what is returned by the server without having to destroy and reinitialize it
  4. Right now there's no one-liner to clear the grid before rehydrating

Describe the solution you'd like
Create a new method on the rows API that will remove every row on the grid, e.g.:

clear() {
  this.dt.data.data.length = 0;
  this.dt.update(true)
}

Describe alternatives you've considered

  1. Set the grid's data.data.length to 0
  2. Call the update method on the grid

Additional context
Example with workaround and use case: https://codepen.io/dday9/pen/OPyZzJK

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions