Grouping results in Select2
jquery-select2
Solution
Yes, the `results` objects support a `children` attribute...
so for example:
var select2Options = {
data: {
results: [
{text: "My shiny group", children: [
{id: 1, text: "My shiny item"},
{id: 2, text: "My shiny item2"}
]}
]
}
};
Problem
Is it possible somehow to group results in a Select2 component when it's not using `<select>` tag, but `<input type="hidden">`, and results are provided as "data" option in configuration object? ``` var select2Options = { data: { results: myArrayOfResults } }; ```