optikalefx / OpenJS-Grid

OpenJS Grid is the easiest jQuery Grid ever. With very little work you can have a data grid that can do everything from sorting and searching to complex database queries. Best of all, its open source. So you can learn how it's all done.
http://square-bracket.com/openjs
MIT License
97 stars 46 forks source link

Cascade drop downs #78

Open jdamianb opened 9 years ago

jdamianb commented 9 years ago

Hi, I was wondering if its possible that the value of a drop down can be a condition for data shown by another dropdown. And if that data can be from any table on the DB.

The thing is that I have a table that shows location, a column for country and another for state, so I would like that in edition mode I can select a country and the dropdown for states only shows me the states from the selected country. I have a table for countries and another for states where each one has its own code and the code for its country (3 columns).

Let me know if it is possible.

Thank you,

optikalefx commented 9 years ago

So to do that, you'd need some custom JS. That isn't natively supported. I would serve an empty drop down for the 2nd column, and then use JS to catch the "change" event on the first, and modify the contents of the 2nd. You may need to add the column to the saveArray to make sure openJS Grid saves it

jdamianb commented 9 years ago

Great advice, when I end it up I will post it here.