From 0459ac89f5204553c4054bb9bebe8ca870a787a2 Mon Sep 17 00:00:00 2001 From: alexweissman Date: Thu, 31 Aug 2017 18:36:44 -0400 Subject: [PATCH] Results for grouped options (see #4662) --- docs/_includes/options/data/ajax.html | 45 +++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/docs/_includes/options/data/ajax.html b/docs/_includes/options/data/ajax.html index ad1b4e92..fbfb7a8c 100644 --- a/docs/_includes/options/data/ajax.html +++ b/docs/_includes/options/data/ajax.html @@ -32,11 +32,11 @@ { "results": [ { - "id": "1", + "id": 1, "text": "Option 1" }, { - "id": "2", + "id": 2, "text": "Option 2" } ], @@ -44,6 +44,47 @@ "more": true } } +{% endhighlight %} + +

Results for grouped options

+ +

+ When options are to be generated in <optgroup> sections, options should be nested under the children attribute of each group object: + +{% highlight json linenos %} +{ + "results": [ + { + "text": "Group 1", + "children" : [ + { + "id": 1, + "text": "Option 1.1" + } + { + "id": 2, + "text": "Option 1.2" + } + ] + }, + { + "text": "Group 2", + "children" : [ + { + "id": 3, + "text": "Option 2.1" + } + { + "id": 4, + "text": "Option 2.2" + } + ] + } + ], + "paginate": { + "more": true + } +} {% endhighlight %}