Fixes in ajax list
This commit is contained in:
parent
95ae3c3abe
commit
51874b339a
1 changed files with 29 additions and 2 deletions
31
ajax_list.js
31
ajax_list.js
|
|
@ -252,6 +252,8 @@ $=jQuery;
|
|||
|
||||
activate=0;
|
||||
|
||||
num_items_default=20;
|
||||
|
||||
//order ASC=0, DESC=1
|
||||
|
||||
order=0;
|
||||
|
|
@ -283,6 +285,8 @@ $=jQuery;
|
|||
|
||||
/*$(this).append(list_tr);*/
|
||||
|
||||
arr_num_items=[0, 10, 20, 50, 100];
|
||||
|
||||
if(!options.hasOwnProperty("num_elements")) {
|
||||
|
||||
options.num_elements=20;
|
||||
|
|
@ -306,7 +310,6 @@ $=jQuery;
|
|||
|
||||
}
|
||||
|
||||
|
||||
this.fields=fields;
|
||||
|
||||
this.options=options;
|
||||
|
|
@ -371,6 +374,7 @@ $=jQuery;
|
|||
|
||||
$(this).append(list_tr);
|
||||
|
||||
options.num_elements=$('#'+$(this).attr('id')+'_number_of_items').val();
|
||||
|
||||
//In url you can send, begin_page, num_elements for pagination.
|
||||
|
||||
|
|
@ -565,9 +569,32 @@ $=jQuery;
|
|||
|
||||
console.log('Search all...')
|
||||
|
||||
$('<p class=""><label for="'+$(this).attr('id')+'_search_in_table">Search:</label> <input type="search" id="'+$(this).attr('id')+'_search_in_table" placeholder="Search in all fields"/></p>').insertBefore($(this));
|
||||
$('<p class=""><label for="'+$(this).attr('id')+'_search_in_table">Search:</label> <input type="search" id="'+$(this).attr('id')+'_search_in_table" placeholder="Search in all fields"/> <label for="'+$(this).attr('id')+'_num_items_in_table">Num. of items:</label> <select name="'+$(this).attr('id')+'_num_elements" id="'+$(this).attr('id')+'_number_of_items"><option value="0">All</option> <option value="10">10</option> <option value="20">20</option> <option value="50">50</option> <option value="100">100</option></select></p>').insertBefore($(this));
|
||||
//console.log($(this).attr('id'));
|
||||
|
||||
var index=arr_num_items.indexOf(options.num_elements);
|
||||
|
||||
if(index!=-1) {
|
||||
|
||||
//console.log(index);
|
||||
//'+$(this).attr('id')+'_number_of_items
|
||||
|
||||
$('#'+$(this).attr('id')+'_number_of_items option:eq('+index+')').prop('selected', true);
|
||||
|
||||
}
|
||||
|
||||
$('#'+$(this).attr('id')+'_number_of_items').on('change', {table: this}, function (e) {
|
||||
|
||||
begin_page=0;
|
||||
|
||||
e.data.table.updateAjaxList();
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
//$(form).find(".input_performance").on('keyup', function (e) {
|
||||
|
||||
function update_list_search(e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue