Skip to content

add / remove rows without having to reset the whole datagrid #352

@jgunstone

Description

@jgunstone

Is your feature request related to a problem? Please describe.
When using Datagrid as a UI object, I'm often required to allow users to add or remove rows. Currently the only way that I know to do this is to reset the .data object recreating all of the data in the grid. For large grids this is slow, and it resets the view which is confusing to the user.

Describe the solution you'd like
Similar to the set_cell_value method, we'd like delete_row and add_row methods that make edits to the self._data object and the grid frontend in-place and then self._notify_cell_change or similar to register the change. The hope would be that by not having to reset the whole grid there is a speed improvement and that it can happen "in-place" without resetting the view of the grid.

Describe alternatives you've considered

  • overwriting the whole grid as described above.
  • had considered leaving some empty rows at the bottom of the table which would allow more to use the set_cell_value to move data around in the grid instead, but this feels very hacky

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