How to implement Select2 dropdown to be dependent on another dropdown in the datatable. SubFiltering

How to implement Select2 dropdown to be dependent on another dropdown in the datatable. SubFiltering

MichaelGibbsMichaelGibbs Posts: 10Questions: 3Answers: 0

http://live.datatables.net/bixikujo/123/edit

Hi, I've tried for hours and hours to try to see if I could create some sort of subfiltering that you would see in excel. It is where if you choose an option in one of the dropdowns, then in the other dropdowns it'll only be options related to the first selected option. I just want to know if this is possible with Select2 dropdowns because that is what I'm using. Please, any help would be greatly appreciated.

Answers

  • kthorngrenkthorngren Posts: 21,180Questions: 26Answers: 4,923

    See Allan's example from this thread to create cascading select lists.

    Kevin

  • MichaelGibbsMichaelGibbs Posts: 10Questions: 3Answers: 0

    Hi Kevin, thanks for nudging me in the right direction. But for select2 dropdowns, when i implemented the code, it didn't seem to work. What additional steps do you think I would have to take here to get it to work for that?

  • kthorngrenkthorngren Posts: 21,180Questions: 26Answers: 4,923

    Do you have an updated example?

    Kevin

  • MichaelGibbsMichaelGibbs Posts: 10Questions: 3Answers: 0

    http://live.datatables.net/bixikujo/123/edit

    I'm not the strongest at JavaScript so I might be completely off with what I did and how I implemented it. apologies

  • MichaelGibbsMichaelGibbs Posts: 10Questions: 3Answers: 0

    sorry, wrong link. Here is the right one.

    http://live.datatables.net/nucojuha/1/edit

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    In your example, you're only building the lists when the table is initialised in initComplete. If you look at the example Kevin pointed you towards, it does it on each draw as well - so you need to use that logic too.

    Colin

This discussion has been closed.