Fix in ajax list
This commit is contained in:
parent
263dda4721
commit
dca8728315
1 changed files with 28 additions and 6 deletions
34
ajax_list.js
34
ajax_list.js
|
|
@ -250,6 +250,8 @@ $=jQuery;
|
||||||
|
|
||||||
search_fields=[];
|
search_fields=[];
|
||||||
|
|
||||||
|
activate=0;
|
||||||
|
|
||||||
//order ASC=0, DESC=1
|
//order ASC=0, DESC=1
|
||||||
|
|
||||||
order=0;
|
order=0;
|
||||||
|
|
@ -342,6 +344,15 @@ $=jQuery;
|
||||||
|
|
||||||
this.updateAjaxList=function () {
|
this.updateAjaxList=function () {
|
||||||
|
|
||||||
|
//Stop other updateAjaxList if activate.
|
||||||
|
|
||||||
|
if(activate) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
options=this.options;
|
options=this.options;
|
||||||
|
|
||||||
/*if(options.hasOwnProperty("loading")) {
|
/*if(options.hasOwnProperty("loading")) {
|
||||||
|
|
@ -363,6 +374,7 @@ $=jQuery;
|
||||||
|
|
||||||
//In url you can send, begin_page, num_elements for pagination.
|
//In url you can send, begin_page, num_elements for pagination.
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: options.url,
|
url: options.url,
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
|
|
@ -370,7 +382,9 @@ $=jQuery;
|
||||||
table: this,
|
table: this,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
||||||
$(this.table).find('.loading_cells').remove();
|
$(this.table).find('tr.row_list').remove();
|
||||||
|
|
||||||
|
//$(this.table).find('.loading_cells').remove();
|
||||||
|
|
||||||
//$(options.loading).hide();
|
//$(options.loading).hide();
|
||||||
|
|
||||||
|
|
@ -447,12 +461,14 @@ $=jQuery;
|
||||||
|
|
||||||
//Add input event to search when search is done
|
//Add input event to search when search is done
|
||||||
|
|
||||||
var search_input='#'+$(this.table).attr('id')+'_search_in_table';
|
//var search_input='#'+$(this.table).attr('id')+'_search_in_table';
|
||||||
|
|
||||||
$(search_input).on('input', {table: this.table}, update_list_search);
|
//$(search_input).on('input', {table: this.table}, update_list_search);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activate=0;
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function (data) {
|
error: function (data) {
|
||||||
|
|
@ -462,6 +478,8 @@ $=jQuery;
|
||||||
|
|
||||||
alert('Error: '+data.status+' '+data.statusText);
|
alert('Error: '+data.status+' '+data.statusText);
|
||||||
|
|
||||||
|
activate=0;
|
||||||
|
|
||||||
},
|
},
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
});
|
});
|
||||||
|
|
@ -554,18 +572,22 @@ $=jQuery;
|
||||||
|
|
||||||
function update_list_search(e) {
|
function update_list_search(e) {
|
||||||
|
|
||||||
var search_input='#'+$(e.data.table).attr('id')+'_search_in_table';
|
//e.stopPropagation();
|
||||||
|
|
||||||
$(search_input).off();
|
//var search_input='#'+$(e.data.table).attr('id')+'_search_in_table';
|
||||||
|
|
||||||
|
//$(search_input).off();
|
||||||
|
|
||||||
search_all_text=$(this).val();
|
search_all_text=$(this).val();
|
||||||
|
|
||||||
e.data.table.updateAjaxList();
|
e.data.table.updateAjaxList();
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//$('#'+$(this).attr('id')+'_search_in_table').on('input', {table: this}, update_list_search);
|
$('#'+$(this).attr('id')+'_search_in_table').on('input', {table: this}, update_list_search);
|
||||||
}
|
}
|
||||||
|
|
||||||
//First loading of list
|
//First loading of list
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue