End User define drop down options

End User define drop down options

bfarkasbfarkas Posts: 127Questions: 33Answers: 0

Hi,
I’ve been going down the road of parent/child table to achieve a result, but thinking maybe its the wrong route.
My goal is to allow users to define 3-4 options which become available as a select/drop down field on the main table. I am working entirely front end and JavaScript based. Is maybe some type of custom button that appends the choice options to the field is maybe better?
Any thoughts or examples?
Thanks!

Answers

  • kthorngrenkthorngren Posts: 10,638Questions: 25Answers: 2,427

    Maybe something like Select2 with tags will do what you want.

    Kevin

  • bfarkasbfarkas Posts: 127Questions: 33Answers: 0

    Hmm. I like the thought but don’t think it will get there as the new options don’t become choices in the drop down for other line entries.

  • kthorngrenkthorngren Posts: 10,638Questions: 25Answers: 2,427

    Sounds like we need more details of what you want. Can you post a link to your page or a test case that shows what you have?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    How do you want the users to supply the select options? Is this to be a realtime update of the select lists or stored somewhere and loaded at the time of table initialization?

    Kevin

  • bfarkasbfarkas Posts: 127Questions: 33Answers: 0

    This is all frontend/JavaScript based so no load or storage.

    The goal is to have a field that users can use to categorize, but the choices are personal to the user so I want them to be able to define them and be able to use in a drop down choice immediately. Essentially the goal is to be a free entry text field but to eliminate the issue of spelling mistakes/capitalization/etc. when trying to put the same category.

    I was initially thinking two tables, one that is simple one column to add these categories to. Then one of the fields in the second table would have its options defined by the current values in the first table.

  • kthorngrenkthorngren Posts: 10,638Questions: 25Answers: 2,427

    One option to update the column with the selects is to use cells().every() and in the loop use cell().node() to get the select input. Then use jQuery or something like this to add the option(s) to the select.

    Kevin

Sign In or Register to comment.