74 lines
2.4 KiB
PHP
74 lines
2.4 KiB
PHP
<script type='text/javascript'>
|
|
var mem_select=0;
|
|
$(document).ready(function() {
|
|
|
|
createPagination(0);
|
|
$('#pagination').on('click','a',function(e){
|
|
e.preventDefault();
|
|
var pageNum = $(this).attr('data-ci-pagination-page');
|
|
createPagination(pageNum);
|
|
});
|
|
|
|
$("body").on("keyup", "input.filtre_1", function(){
|
|
createPagination(0,1)
|
|
});
|
|
$("body").on("keyup", "input.filtre_2", function(){
|
|
createPagination(0,2)
|
|
});
|
|
mem_select=0;
|
|
$("body").on("change", ".filtre_3", function(){
|
|
var optionSelected = $("option:selected", this);
|
|
mem_select = this.value;
|
|
|
|
createPagination(0,3)
|
|
|
|
});
|
|
(function($){
|
|
$.fn.focusTextToEnd = function(){
|
|
this.focus();
|
|
var $thisVal = this.val();
|
|
this.val('').val($thisVal);
|
|
return this;
|
|
}
|
|
}(jQuery));
|
|
function createPagination(pageNum,nofiltre=1,){
|
|
|
|
if (typeof $('input.filtre_1').val()!=='undefined' && $('input.filtre_1').val()!="" )
|
|
mem_filtre_1=$('input.filtre_1').val().trim();
|
|
else
|
|
mem_filtre_1='null';
|
|
|
|
if (typeof $('input.filtre_2').val()!=='undefined' && $('input.filtre_2').val()!=""){
|
|
|
|
mem_filtre_2=$('input.filtre_2').val().trim();}
|
|
else
|
|
mem_filtre_2='null';
|
|
|
|
if (mem_select!=0)
|
|
|
|
mem_filtre_3=mem_select;
|
|
else
|
|
mem_filtre_3='null';
|
|
|
|
//alert(mem_filtre_1);
|
|
// alert(mem_filtre_2);
|
|
$.ajax({
|
|
url: '<?=base_url()?>index.php/Fournisseurs/loadData_list/'+pageNum+'/'+mem_filtre_1+'/'+mem_filtre_2+'/'+mem_filtre_3,
|
|
type: 'get',
|
|
dataType: 'json',
|
|
success: function(responseData){
|
|
$('#pagination').empty();
|
|
$('#pagination').html(responseData.pagination);
|
|
$('#employeeList').empty();
|
|
$('#employeeList').html(responseData.list);
|
|
$('#Fournisseurs_actif').empty();
|
|
$('#Fournisseurs_actif').html(responseData.recordCount);
|
|
|
|
$('input.filtre_'+nofiltre).focusTextToEnd();
|
|
}
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
</script> |