Comments (2)
Hello again @sachin-smart and thank you for the feature suggestions!
ipydatagrid
was designed to be extended using the widget ecosystem, and therefore it is probably not within scope to incorporate rendering logic based on data type - that logic is something users can implement using the existing Python language constructs.
To your point on using a single, default renderer for the grid - this exists and is actually well documented in the examples folder. All of ipydatagrid
's documentation is example based. We can also use basic Python to implement logic for selecting a different header renderer for each column based on its data type. See below for a short example which achieves that:
import pandas as pd
import numpy as np
import ipydatagrid as datagrid
data = pd.DataFrame({'Integer':[1,2,3,4,5],
'Float':[1.1, 2.2, 3.3, 4.4, 5.5],
'Text':'A B C D E'.split(),
'Dates':pd.date_range(start='2021-06-01', end='2021-06-05'),
'Mixed':[1, 2.2, 'C', np.datetime64('2021-05-05'), 5]})
default_renderer = datagrid.TextRenderer(background_color="salmon")
string_renderer = datagrid.TextRenderer(background_color="limegreen")
int_renderer = datagrid.TextRenderer(background_color="yellow")
dtype_renderers = {
np.dtype('int64'): int_renderer,
np.dtype('O'): string_renderer
}
column_renderers = {name:dtype_renderers[dtype] for (name, dtype) in data.dtypes.items() if dtype in dtype_renderers}
grid = datagrid.DataGrid(data,
default_renderer=default_renderer,
renderers=column_renderers,
layout={"height":"150px"})
grid
from ipydatagrid.
That's great. Much appreciated! And apologies, I did not see the full extent of examples or the usage of default_renderer. Cheers!
from ipydatagrid.
Related Issues (20)
- Can't filter rows with NaN values HOT 3
- unknown extension in voila HOT 2
- Cannot edit the table using responsive setting HOT 2
- DataGrid does not render table on Google Colab anymore HOT 3
- How to format arrays of floats? HOT 2
- Filter/sort controls not selectable in latest version HOT 7
- Automatically resizing the row height, based on biggest cell. HOT 1
- map a user-facing title to a backend name
- auto_fit_columns not working when setting data HOT 1
- Nested hierarchies with common entries on level 1 cause issues HOT 4
- Disabling filtering/sorting icon in UI HOT 1
- VScode doesn't display Datagrid HOT 5
- How to create a sortable and filterable Datagrid HOT 3
- Column width is reverting back to defaults randomly after updating the data in the datagrid HOT 6
- Missing NPM publish on 1.2.1 HOT 2
- select function not trigger observe HOT 1
- Exporting Ipydatagrid to html
- Identify column by name in renderer rather than index.
- Any way to control the location of scroll of ipydatagrid HOT 2
- Use var(--something) to color cells HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipydatagrid.