-
Notifications
You must be signed in to change notification settings - Fork 53
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
🐛 Resolved issue for data getter when datagrid is empty #358
Conversation
ff609c1
to
a913b40
Compare
Tests to add:
|
@ollyhensby Thanks again for the contributions 🤩 |
Signed-off-by: Oliver Hensby <[email protected]> Updated development installation in readme.md Signed-off-by: Oliver Hensby <[email protected]> Remove unused file-loader Signed-off-by: Itay Dafna <[email protected]> Migrate to hatch Signed-off-by: martinRenou <[email protected]> Release 1.1.13 Signed-off-by: Itay Dafna <[email protected]> Exclude map files in production Signed-off-by: martinRenou <[email protected]> Update version, add file exclusions for packaging Signed-off-by: Itay Dafna <[email protected]>
1c3124c
to
86a6829
Compare
Signed-off-by: Oliver Hensby <[email protected]> 🎨 Ran black formatter Formatted again. Docstring was too long
5e4f5b5
to
0dd40e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work. Thank you! 🌟
@@ -412,7 +412,12 @@ def __handle_custom_msg(self, _, content, buffers): # noqa: U101,U100 | |||
@property | |||
def data(self): | |||
trimmed_primary_key = self._data["schema"]["primaryKey"][:-1] | |||
df = pd.DataFrame(self._data["data"]) | |||
if self._data["data"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self._data["data"]: | |
if "data" in self._data: |
If the "data" key doesn't exist in self._data
then self._data["data"]
will throw an error. This is a bit safer 😊
Issue number of the reported bug or feature request: #322
Describe your changes
Added an if statement to check the _data traitlet and see if its "data" value is empty within the data getter method. If it is empty, then construct an empty dataframe from the schema fields so final_df will be constructed from that df.
Testing performed
Re-ran the code in the issue.
We get this output:
We see that the DataGrid UI object reflects those changes (we only have the columns):
Additional context
No additional information.