Comments (8)
Yes this seems reasonable.
from bubble-table.
I think this is actually already possible. In this situation, what I would do is read in the CSV headers as columns and start with those as Column
s. Then, for every row, create RowData
that contains every column that the row contains. If there are missing columns, you don't need to fill them in. If a row doesn't have the data in its RowData
, it will simply be blank for that column.
Additionally you can add columns dynamically by using WithColumns
. When your async loading returns more data, if it returns more columns you can regenerate the column list and use WithColumns
on the table. It will keep the same data, and any rows that didn't have the new columns will simply show blanks for the new columns.
from bubble-table.
Thanks, I wasn't aware of WithColumns
.
Another issue that I ran into is the fact that not all CSVs have a "header" row so:
- We'd need a way to not have a column header row on table UI.
- The bigger issue is that
RowData
is amap[string]
but in cases like these where there is no header, OR where the header is shorter than some row. What column name do we use? I guess, we could generate internal column names like_c1
,_c2
etc?
from bubble-table.
We'd need a way to not have a column header row on table UI.
As in, some column headers shouldn't show up in the table, or that the entire header row should not be visible? The latter is a new feature, and I think that would be reasonable to add.
The bigger issue is that RowData is a map[string] but in cases like these where there is no header, OR where the header is shorter than some row. What column name do we use? I guess, we could generate internal column names like _c1, _c2 etc?
Yes, I think that's what needs to happen here. I would keep track of some incrementing value, and go from there. I'm cautiously open to ideas if you think some mechanism in bubble-table itself might be useful, but right now I suspect this is best handled by the client code with the data for now.
from bubble-table.
As in, some column headers shouldn't show up in the table, or that the entire header row should not be visible? The latter is a new feature, and I think that would be reasonable to add.
If the CSV has no header, then the entire header row should not be visible.
In cases where the header is smaller than some row, and we use generated column names, I would want to hide those particular columns as well. So, for eg. there could be 5 columns (Name
, Age
, Gender
, _c1
, _c2
) but only 3 of the headers should be visible on the UI. The remaining two headers should be "empty".
This is what the Visidata does - and is the right thing to do IMO:
Also notice how missing values (in the last row) are shown differently than empty values. That is something bubble-table should incorporate as well. Empty values should not be used to represent missing ones.
from bubble-table.
I think there are two issues to address with code changes on bubble table's end given the above:
- Allow header row to be hidden (I think this is probably best to start with a simple toggle option)
- Add "missing data" option to be shown when data is missing from row (to differentiate between that and empty string or zero value) to match behavior above
For current functionality, regarding the hiding of columns, there are two points that should cover this depending on what you mean by "hide":
- If the column doesn't exist on the table, the column won't appear... but the rows can still safely contain whatever data you wish, so you can mix and match columns as you like
- The column can have an empty title, but still have the
_cX
key to match it with data. This should cover a situation where the CSV has no header value but you still want to display the data.
Does the above sound reasonable to you? If it does I can create two issues for the first two for clarity/tracking.
from bubble-table.
I've added the two features and released as v0.13.5
, let me know if that covers the remaining use cases.
from bubble-table.
I'm going to close this for now for tidiness, but please feel free to reopen it if there's anything missing, or open a new issue if there's anything new that comes up!
from bubble-table.
Related Issues (20)
- Allow some configurable indicator of missing data
- Conflicting keymap entries cause confusing behavior HOT 1
- Support mouse hover and mouse click event
- Option to Turn Off Page Wrapping HOT 1
- Support independent styling for column data vs column headers HOT 1
- feat: method to expand to fill height tea.WithAltScreen() HOT 5
- feat: custom filter text HOT 13
- Filter text cursor resets base style such as color
- artifacts on terminal resize HOT 8
- How to find out if filter input is currently active? HOT 2
- align
- How can I format numbers in a sortable column? HOT 3
- Flexible max number of rows based on size of the terminal HOT 8
- Columns seem to ignore lipgloss padding HOT 7
- Filtering doesn't work on non-stringer values
- performance of filtering a large table HOT 13
- redraw after filtering HOT 3
- Deselect all rows programatically
- Row select method docs are misleading
- Test failure: Test3xWithFilterFooter HOT 4
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 bubble-table.