Show More
@@ -1097,7 +1097,13 b' the specific language governing permissi' | |||||
1097 |
|
1097 | |||
1098 | // collect the created nodes for bulk append |
|
1098 | // collect the created nodes for bulk append | |
1099 | var nodes = []; |
|
1099 | var nodes = []; | |
1100 | for (i = 0, l = results.length; i < l; i = i + 1) { |
|
1100 | ||
|
1101 | // Kallithea customization: maxResults | |||
|
1102 | l = results.length; | |||
|
1103 | if (query.term.length == 0 && l > opts.maxResults) { | |||
|
1104 | l = opts.maxResults; | |||
|
1105 | } | |||
|
1106 | for (i = 0; i < l; i = i + 1) { | |||
1101 |
|
1107 | |||
1102 | result=results[i]; |
|
1108 | result=results[i]; | |
1103 |
|
1109 | |||
@@ -1138,6 +1144,10 b' the specific language governing permissi' | |||||
1138 | nodes.push(node[0]); |
|
1144 | nodes.push(node[0]); | |
1139 | } |
|
1145 | } | |
1140 |
|
1146 | |||
|
1147 | if (results.length >= opts.maxResults) { | |||
|
1148 | nodes.push($('<li class="select2-no-results"><div class="select2-result-label">Too many matches found</div></li>')); | |||
|
1149 | } | |||
|
1150 | ||||
1141 | // bulk append the created nodes |
|
1151 | // bulk append the created nodes | |
1142 | container.append(nodes); |
|
1152 | container.append(nodes); | |
1143 | liveRegion.text(opts.formatMatches(results.length)); |
|
1153 | liveRegion.text(opts.formatMatches(results.length)); | |
@@ -1161,16 +1171,25 b' the specific language governing permissi' | |||||
1161 |
|
1171 | |||
1162 | if (select) { |
|
1172 | if (select) { | |
1163 | opts.query = this.bind(function (query) { |
|
1173 | opts.query = this.bind(function (query) { | |
|
1174 | // Kallithea customization: maxResults | |||
1164 | var data = { results: [], more: false }, |
|
1175 | var data = { results: [], more: false }, | |
1165 | term = query.term, |
|
1176 | term = query.term, | |
1166 |
children, placeholderOption, process |
|
1177 | children, placeholderOption, process, | |
|
1178 | maxResults = opts.maxResults || -1, | |||
|
1179 | termLower = term.toLowerCase(); | |||
1167 |
|
1180 | |||
1168 | process=function(element, collection) { |
|
1181 | process=function(element, collection) { | |
1169 | var group; |
|
1182 | var group; | |
1170 | if (element.is("option")) { |
|
1183 | if (element.is("option")) { | |
|
1184 | if (collection.length < maxResults) { | |||
1171 | if (query.matcher(term, element.text(), element)) { |
|
1185 | if (query.matcher(term, element.text(), element)) { | |
1172 | collection.push(self.optionToData(element)); |
|
1186 | collection.push(self.optionToData(element)); | |
1173 | } |
|
1187 | } | |
|
1188 | } else { | |||
|
1189 | if (element.text().toLowerCase().indexOf(termLower) == 0) { | |||
|
1190 | collection.push(self.optionToData(element)); | |||
|
1191 | } | |||
|
1192 | } | |||
1174 | } else if (element.is("optgroup")) { |
|
1193 | } else if (element.is("optgroup")) { | |
1175 | group=self.optionToData(element); |
|
1194 | group=self.optionToData(element); | |
1176 | element.children().each2(function(i, elm) { process(elm, group.children); }); |
|
1195 | element.children().each2(function(i, elm) { process(elm, group.children); }); |
@@ -308,7 +308,7 b'' | |||||
308 | // change branch filter |
|
308 | // change branch filter | |
309 | $("#branch_filter").select2({ |
|
309 | $("#branch_filter").select2({ | |
310 | dropdownAutoWidth: true, |
|
310 | dropdownAutoWidth: true, | |
311 |
m |
|
311 | maxResults: 50, | |
312 | sortResults: branchSort |
|
312 | sortResults: branchSort | |
313 | }); |
|
313 | }); | |
314 |
|
314 |
@@ -233,7 +233,7 b' var callbacks = function(State){' | |||||
233 | // change branch filter |
|
233 | // change branch filter | |
234 | $("#branch_selector").select2({ |
|
234 | $("#branch_selector").select2({ | |
235 | dropdownAutoWidth: true, |
|
235 | dropdownAutoWidth: true, | |
236 | minimumInputLength: 1, |
|
236 | maxResults: 50, | |
237 | sortResults: branchSort |
|
237 | sortResults: branchSort | |
238 | }); |
|
238 | }); | |
239 |
|
239 |
@@ -202,6 +202,7 b'' | |||||
202 |
|
202 | |||
203 | $("#org_ref").select2({ |
|
203 | $("#org_ref").select2({ | |
204 | dropdownAutoWidth: true, |
|
204 | dropdownAutoWidth: true, | |
|
205 | maxResults: 50, | |||
205 | sortResults: branchSort |
|
206 | sortResults: branchSort | |
206 | }); |
|
207 | }); | |
207 | $("#org_ref").on("change", function(e){ |
|
208 | $("#org_ref").on("change", function(e){ | |
@@ -217,6 +218,7 b'' | |||||
217 |
|
218 | |||
218 | $("#other_ref").select2({ |
|
219 | $("#other_ref").select2({ | |
219 | dropdownAutoWidth: true, |
|
220 | dropdownAutoWidth: true, | |
|
221 | maxResults: 50, | |||
220 | sortResults: branchSort |
|
222 | sortResults: branchSort | |
221 | }); |
|
223 | }); | |
222 | $("#other_ref").on("change", function(e){ |
|
224 | $("#other_ref").on("change", function(e){ |
General Comments 0
You need to be logged in to leave comments.
Login now