Lines 134-139
Link Here
|
134 |
[% END %] |
134 |
[% END %] |
135 |
|
135 |
|
136 |
[% IF cities_count > 0 %] |
136 |
[% IF cities_count > 0 %] |
|
|
137 |
<div class="table_cities_table_controls"></div> |
137 |
<table id="table_cities"> |
138 |
<table id="table_cities"> |
138 |
<thead> |
139 |
<thead> |
139 |
<tr> |
140 |
<tr> |
Lines 167-174
Link Here
|
167 |
[% Asset.js("js/admin-menu.js") | $raw %] |
168 |
[% Asset.js("js/admin-menu.js") | $raw %] |
168 |
[% INCLUDE 'datatables.inc' %] |
169 |
[% INCLUDE 'datatables.inc' %] |
169 |
<script> |
170 |
<script> |
|
|
171 |
|
170 |
$(document).ready(function() { |
172 |
$(document).ready(function() { |
171 |
var cities_table_url = '/api/v1/cities?'; |
173 |
var cities_table_url = '/api/v1/cities?'; |
|
|
174 |
|
172 |
[% IF city_name_filter %] |
175 |
[% IF city_name_filter %] |
173 |
var city_name_filter = { |
176 |
var city_name_filter = { |
174 |
'name': { |
177 |
'name': { |
Lines 177-186
Link Here
|
177 |
}; |
180 |
}; |
178 |
cities_table_url += 'q='+ encodeURIComponent(JSON.stringify(city_name_filter)); |
181 |
cities_table_url += 'q='+ encodeURIComponent(JSON.stringify(city_name_filter)); |
179 |
[% END %] |
182 |
[% END %] |
|
|
183 |
|
184 |
$('#table_cities thead tr').clone(true).appendTo( '#table_cities thead' ); |
185 |
|
186 |
|
180 |
var cities_table = $("#table_cities").api({ |
187 |
var cities_table = $("#table_cities").api({ |
181 |
"ajax": { |
188 |
"ajax": { |
182 |
"url": cities_table_url |
189 |
"url": cities_table_url |
183 |
}, |
190 |
}, |
|
|
191 |
orderCellsTop: true, |
184 |
"order": [[ 1, "asc" ]], |
192 |
"order": [[ 1, "asc" ]], |
185 |
"columnDefs": [ { |
193 |
"columnDefs": [ { |
186 |
"targets": [0,1,2,3,4], |
194 |
"targets": [0,1,2,3,4], |
Lines 229-235
Link Here
|
229 |
"orderable": false |
237 |
"orderable": false |
230 |
} |
238 |
} |
231 |
] |
239 |
] |
232 |
}); |
240 |
}, [], 1); |
|
|
241 |
|
242 |
|
243 |
var table = cities_table.DataTable(); |
244 |
$('#table_cities thead tr:eq(1) th').each( function (i) { |
245 |
var is_searchable = table.settings()[0].aoColumns[i].bSearchable; |
246 |
if ( is_searchable ) { |
247 |
var title = $(this).text(); |
248 |
var search_title = _("Search %s").format(title); |
249 |
$(this).html( '<input type="text" placeholder="%s" />'.format(search_title) ); |
250 |
|
251 |
$( 'input', this ).on( 'keyup change', function () { |
252 |
if ( table.column(i).search() !== this.value ) { |
253 |
table |
254 |
.column(i) |
255 |
.search( this.value ) |
256 |
.draw(); |
257 |
} |
258 |
} ); |
259 |
} else { |
260 |
$(this).html(''); |
261 |
} |
262 |
} ); |
263 |
|
233 |
}); |
264 |
}); |
234 |
</script> |
265 |
</script> |
235 |
[% END %] |
266 |
[% END %] |
236 |
- |
|
|