1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! Support for the **grouped** `Select2` output format. Renders categorized
//! data into HTML
//! [\<optgroup\>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup)
//! sections.
// -----------------------------------------------------------------------------
use crate;
use ;
use ;
use Debug;
use Hash;
use ToString;
// -----------------------------------------------------------------------------
//
/// For the `select2::grouped` module to work with your records, you must
/// implement this `Groupable` trait for it. The trait returns
/// `GroupableRecord` which contains the information needed to make it usable
/// and groupable for the `Select2` jQuery plug-in.
///
/// When options are to be generated in `<optgroup>` sections, options should be
/// nested under the `children` key of each group object. The label for the
/// group should be specified as the `text` property on the group's
/// corresponding data object.
// Groupable
// -----------------------------------------------------------------------------
//
/// When options are to be generated in `<optgroup>` sections, options should be
/// nested under the `children` key of each group object. The label for the
/// group should be specified as the `text` property on the group's
/// corresponding data object.
// Group
// -----------------------------------------------------------------------------
//
/// For the `select2::grouped` module to work with your records, you must
/// implement the `Groupable` trait it. This trait will return a
/// `GroupableRecord` struct. In other words, you must implement a trait that
/// converts your record into this struct.
///
/// Select2 can render programmatically supplied data from an array or remote
/// data source (AJAX) as dropdown options. In order to accomplish this, Select2
/// expects a very specific data format. This format consists of a JSON object
/// containing an array of objects keyed by the `results` key.
// GroupableRecord
// -----------------------------------------------------------------------------
// impl
// -----------------------------------------------------------------------------
//
/// This `struct` represents the results of the search query. This should be
/// converted to `JSON` using your web framework (or something like
/// `serde_json`), and then returned to the `Select2` jQuery plug-in.
// GroupedResults