Fixes in ajax lists
This commit is contained in:
parent
f3175777e3
commit
c30600ab75
1 changed files with 29 additions and 3 deletions
32
ajax_list.js
32
ajax_list.js
|
|
@ -236,12 +236,22 @@ $=jQuery;
|
|||
|
||||
order_field='';
|
||||
|
||||
search_all=false;
|
||||
|
||||
search_fields=[];
|
||||
|
||||
//order ASC=0, DESC=1
|
||||
|
||||
order=0;
|
||||
|
||||
order_by={};
|
||||
|
||||
if(options.hasOwnProperty("search_all")) {
|
||||
|
||||
search_all=options.search_all;
|
||||
|
||||
}
|
||||
|
||||
if(!options.hasOwnProperty("url")) {
|
||||
|
||||
|
||||
|
|
@ -255,6 +265,12 @@ $=jQuery;
|
|||
|
||||
}
|
||||
|
||||
list_tr='<tr class="row_list"> \
|
||||
<td class="loading_cells" colspan="'+fields.length+'" align="center"><i class="fa fa-refresh fa-spin fa-3x fa-fw"></i><span class="sr-only">Loading...</span></td> \
|
||||
</tr>';
|
||||
|
||||
$(this).append(list_tr);
|
||||
|
||||
if(!options.hasOwnProperty("num_elements")) {
|
||||
|
||||
options.num_elements=20;
|
||||
|
|
@ -312,16 +328,17 @@ $=jQuery;
|
|||
|
||||
}
|
||||
|
||||
order_by[order_field]=0;
|
||||
|
||||
this.updateAjaxList=function () {
|
||||
|
||||
options=this.options;
|
||||
|
||||
if(options.hasOwnProperty("loading")) {
|
||||
/*if(options.hasOwnProperty("loading")) {
|
||||
|
||||
$(options.loading).show();
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
if(options.hasOwnProperty("pre_callback")) {
|
||||
|
||||
|
|
@ -338,7 +355,7 @@ $=jQuery;
|
|||
table: this,
|
||||
success: function (data) {
|
||||
|
||||
$(options.loading).hide();
|
||||
//$(options.loading).hide();
|
||||
|
||||
//console.log(table.options);
|
||||
|
||||
|
|
@ -496,6 +513,15 @@ $=jQuery;
|
|||
|
||||
});
|
||||
|
||||
//For search in all fields
|
||||
|
||||
if(search_all) {
|
||||
|
||||
console.log('Search all...')
|
||||
//$(this).insertBefore('<p class=""><label for="'+$(this).attr('id')+'_search_in_table">Search:</label><input type="search" name="search_in_table" id="'+$(this).attr('id')+'_search_in_table" /></p>');
|
||||
|
||||
}
|
||||
|
||||
//First loading of list
|
||||
|
||||
this.updateAjaxList();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue