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='';
|
order_field='';
|
||||||
|
|
||||||
|
search_all=false;
|
||||||
|
|
||||||
|
search_fields=[];
|
||||||
|
|
||||||
//order ASC=0, DESC=1
|
//order ASC=0, DESC=1
|
||||||
|
|
||||||
order=0;
|
order=0;
|
||||||
|
|
||||||
order_by={};
|
order_by={};
|
||||||
|
|
||||||
|
if(options.hasOwnProperty("search_all")) {
|
||||||
|
|
||||||
|
search_all=options.search_all;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(!options.hasOwnProperty("url")) {
|
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")) {
|
if(!options.hasOwnProperty("num_elements")) {
|
||||||
|
|
||||||
options.num_elements=20;
|
options.num_elements=20;
|
||||||
|
|
@ -312,16 +328,17 @@ $=jQuery;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
order_by[order_field]=0;
|
||||||
|
|
||||||
this.updateAjaxList=function () {
|
this.updateAjaxList=function () {
|
||||||
|
|
||||||
options=this.options;
|
options=this.options;
|
||||||
|
|
||||||
if(options.hasOwnProperty("loading")) {
|
/*if(options.hasOwnProperty("loading")) {
|
||||||
|
|
||||||
$(options.loading).show();
|
$(options.loading).show();
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if(options.hasOwnProperty("pre_callback")) {
|
if(options.hasOwnProperty("pre_callback")) {
|
||||||
|
|
||||||
|
|
@ -338,7 +355,7 @@ $=jQuery;
|
||||||
table: this,
|
table: this,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
||||||
$(options.loading).hide();
|
//$(options.loading).hide();
|
||||||
|
|
||||||
//console.log(table.options);
|
//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
|
//First loading of list
|
||||||
|
|
||||||
this.updateAjaxList();
|
this.updateAjaxList();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue