Mui-datatables: how to switch between demo of examples without restarting npm

Created on 18 Jul 2019  路  5Comments  路  Source: gregnb/mui-datatables


How can I switch between the demo of examples like expandable-rows, serverside-options, etc without having to change webpack.config.js and restart?

I have checked out mui-datatables code and want to see different examples live and possibly change them and see the changes.

I figured out that by changing webpack.config.js:

module.exports = {
entry: {
app: "./examples/customize-filter/index.js"
}

and restarting the app I could accomplish this.

But is there a way to do it without restarting? and without changing the webpack?

One solution I'm hoping for is that there should be direct urls like :
http://localhost:5050/expandable-rows
http://localhost:5050/serverside-options

to see the respective examples.

Expected Behavior

Current Behavior

Steps to Reproduce (for bugs)

1.
2.
3.
4.

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | |
| MUI-datatables | |
| React | |
| browser | |
| etc | |

enhancement

Most helpful comment

@alielkhateeb That's a great start, I would accept that PR! Even better would be to have a simple list of links at examples/index.js or whatever the default page is, but either way is a big improvement.

All 5 comments

There is no way to do this at the moment. I agree it would be nice to have something like this, especially a whole documentation/examples website, but it's not something I'm focused on in the short term.

Thank you for the prompt reply. I can understand your prioritization.

Something you may want to consider while adding this enhancement :
See react-bootstrap-table2 storybook. https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html

My suggestion:

  1. Having examples/index.js as the entry point in webpack.config.js
  2. examples/index.js should have a router to all the examples by folder name

    • Accessing localhost:5050 should take you to examples/simple

    • Accessing localhost:5050/specific-example should take you to examples/specific-example

@gabrielliwerant if you agree on this solution I can start working on it.

@alielkhateeb That's a great start, I would accept that PR! Even better would be to have a simple list of links at examples/index.js or whatever the default page is, but either way is a big improvement.

@gabrielliwerant Cool, I'll start working on that tonight

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chapmanjacobd picture chapmanjacobd  路  4Comments

pranavtheway picture pranavtheway  路  3Comments

Andy1408 picture Andy1408  路  4Comments

kylane picture kylane  路  3Comments

harryluo91 picture harryluo91  路  3Comments