1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
// GRID CONSTRUCTION
$("#list_a_facturer").jqGrid({
url:'php/mapage.php', // va chercher les donnees en php
datatype: 'json', // recupere les donnees en json
colNames:['','Id','Etat','Nom','Prénom','Raison Soc.','Add1','Add2','Cp','Ville'],
colModel :[
{name:'persid', index:'persid', hidden:true},
{name:'id', index:'entr_id', align:'left', width:40, hidden:false},
{name:'etat', index:'etat', align:'center', width:10, hidden:false},
{name:'bim_nom', index:'nom', align:'left', width:50, hidden:false},
{name:'prenom', index:'prenom', align:'left', width:50, hidden:false},
{name:'raisonsoc', index:'raison_sociale', width:50, hidden:false},
{name:'add1', index:'addr_1', width:50, hidden:false},
{name:'add2', index:'addr_2', width:50, hidden:false},
{name:'cp', index:'cp', width:40, hidden:false},
{name:'ville', index:'ville', width:50, hidden:false}
],
width: ($("#list_a_facturer_container").width()), /*//largeur de la div*/
height: 'auto', /*//hauteur de la div*/
pager:'#pager_list_a_facturer',
hidegrid:false,
shrinkToFit:true, /*//etirement de la grille*/
sortname:'nom',
sortorder: "desc",
viewrecords:true,
rowNum:100,
rowList:[50,100,150],
caption: "Resultat de la recherche"
});
$("#list_a_facturer").jqGrid('navGrid','#pager_list_a_facturer',{edit:false,add:false,del:false, search:false});
// COLUMN CHOOSER
jQuery("#list_a_facturer").jqGrid('navButtonAdd','#pager_list_a_facturer',{
caption: "",
title: "Gérer les colonnes",
onClickButton : function (){
console.log('sdge');
var a = jQuery("#list_a_facturer").gridComplete;
jQuery("#list_a_facturer").jqGrid('columnChooser', {
done:function (perm) {
if (perm) {
jQuery("#list_a_facturer").setGridWidth(a); // modifie bien les colonnes affichées
}
}
});
}
});
var pos = $('#list_a_facturer').offset();
$('#list_a_facturer').setGridHeight($('body').height() - pos.top - 10 - $('#pager_list_a_facturer').height()); |
Partager