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

grid does not support add_rows on an empty dataframe. Could we stop the user from removing the last row? #366

Open
camilog04 opened this issue Jul 9, 2021 · 0 comments

Comments

@camilog04
Copy link

Environment

  • Python 3.8.8
  • pip installed

Description of Issue

  • What did you expect to happen?
    when the dataframe is empty, the add row botton from the tool bar does not work.
  • What happened instead?
    I expected that the widget add a row

Reproduction Steps

  1. initialize the qgrid widget with one row
  2. show the widget with the tool bar option
  3. delete all the rows
  4. click the 'add_row' button
    ...

What steps have you taken to resolve this already?

A solution to this is to prevent the users from deleting the rows. This can be accomplished by adding an empty check to the remove_rows method:

  • if self._df.shape[0] <= 1:
    
  •     # Optionally throw a warning here
    
  •     return selected_names
    

...

Anything else?

Another solution is that when the dataframe is empty there is a constroctor of a 'default' row but but this would be more difficult to scale.
...

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

No branches or pull requests

1 participant