-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #434 from apjanusz/main
Added table widget (#433)
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ boto3==1.26.83 | |
cryptography | ||
pyopenssl>=23.1.1 | ||
bleach>=6.0.0 | ||
itables>=2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from itables import show | ||
|
||
import ipywidgets | ||
from IPython.display import display | ||
from .manager import WidgetsManager | ||
|
||
import warnings | ||
|
||
|
||
def Table(data=None, width="auto", text_align="center"): | ||
if data is None: | ||
raise Exception("Please provide data!") | ||
|
||
if "DataFrame" not in str(type(data)): | ||
raise Exception("Wrong data provided! Expected data type is 'DataFrame'.") | ||
|
||
if "%" in width: | ||
raise Exception("Wrong width provided! You can't provide value using '%'.") | ||
|
||
if text_align not in ["center","left","right"]: | ||
raise Exception("Wrong align provided! You can choose one of following options: 'left', 'right', 'center'.") | ||
|
||
text_align= f"dt-{text_align}" | ||
show(data, classes=["display", "cell-border"], columnDefs=[{"className":text_align,"width":width,"targets":"_all"}]) | ||
|