Git Product home page Git Product logo

Comments (4)

nihgwu avatar nihgwu commented on July 17, 2024

Hi, thanks for your detailed description, have you saw the screenshot of our internal table component built on BaseTable, we implemented the column toggling feature too

actually BaseTable supports flexible columns by default, so you only need to calculate if the total width is larger than the table, if so you set fixed={true}, or you could set to fixed={false} and then all the columns are flexible based on the flex layout, and the flex width is automatically based on flex: {flexGrow} {flexShrink} {width}, so if it's flexible, you could set all the columns' width to be 0 or any number and flexGrow={1}, or some with flexGrow={2}

from react-base-table.

keremciu avatar keremciu commented on July 17, 2024

hi @nihgwu Thanks for detailed answer too :) I saw the case but I'm not sure about why I can't use fixed and fluid columns together?

If I don't provide width prop for column then it's giving an error:

Warning: Failed prop type: The prop `columns[1].width` is marked as required in `BaseTable`, but its value is `undefined`. in BaseTable (created by DataTable)

yep yep, I'm calculating the column width if the total width is larger than the table as you can as a condition in my code:
if (expectedWidth > totalWidth) {

I think we can put this functionality inside base-table cause it could be a common case; using fixed and fluid columns together.

from react-base-table.

nihgwu avatar nihgwu commented on July 17, 2024

fluid column could be only available in Flex Mode(fixed=false), and it's available in by default, in Fixed Mode flexGrow=0 flexShrink=0 and could not be changed, in Flex Mode, by default flexGrow=0, flexShrink=1, you could set flexShrink=0 to make this column's width is fixed, if it's flexible, the width is not so important you could even set it to 0, so you you don't like width to be required, you could give it a default value in your DataTable, create your own Column and set defaultProps

I didn't make the Auto Mode builtin as in some case the users just want to keep in Fixed Mode even there are empty space, and that's not hard to implement from user land, and BaseTable is designed to be unopinionated, we could support that via plugins in the future

from react-base-table.

keremciu avatar keremciu commented on July 17, 2024

@nihgwu I got your point now, yep maybe I need to put this functionality in a different repository as react-base-table-fluid then we can just make it as a plugin to base-table.

we can define a minWidth for the default cause when user put 0 width for column then there's no way to see it on the screen.

I will try to make this ready then we can talk about on that like is there any disadvantage or a problem maybe

from react-base-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.