gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.7k stars 931 forks source link

how to switch between demo of examples without restarting npm #778

Closed be-a-bee closed 5 years ago

be-a-bee commented 5 years ago

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
gabrielliwerant commented 5 years ago

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.

be-a-bee commented 5 years ago

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

alielkhateeb commented 5 years ago

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.

gabrielliwerant commented 5 years ago

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

alielkhateeb commented 5 years ago

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