Giter VIP home page Giter VIP logo

Comments (8)

dufferzafar avatar dufferzafar commented on May 24, 2024 1

Yes this seems reasonable.

from bubble-table.

Evertras avatar Evertras commented on May 24, 2024

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 Columns. 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.

dufferzafar avatar dufferzafar commented on May 24, 2024

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:

  1. We'd need a way to not have a column header row on table UI.
  2. 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?

from bubble-table.

Evertras avatar Evertras commented on May 24, 2024

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.

dufferzafar avatar dufferzafar commented on May 24, 2024

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:

image

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.

Evertras avatar Evertras commented on May 24, 2024

I think there are two issues to address with code changes on bubble table's end given the above:

  1. Allow header row to be hidden (I think this is probably best to start with a simple toggle option)
  2. 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":

  1. 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
  2. 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.

Evertras avatar Evertras commented on May 24, 2024

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.

Evertras avatar Evertras commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.