Advertisement
Guest User

Untitled

a guest
Mar 26th, 2014
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $('#jqList').jqGrid({
  2.         url: fullBaseUrl+'/candidats/doublons_ws.json',
  3.     datatype: 'json',
  4.     colNames:['ID', 'Nom', 'Prénom', 'Date de naissance', 'Nb doublons'],
  5.     colModel:[
  6.         {name:'id',index:'id', hidden:true},
  7.         {name:'nom',index:'nom', width:200},
  8.         {name:'prenom', index:'prenom', width:200},
  9.                 {name:'date_naissance', index:'date_naissance', width:200, formatter: 'date', formatoptions: {
  10.                         srcformat: 'Y-m-d',
  11.                         newformat: 'd/m/Y'
  12.                 }},
  13.         {name:'nbr_doublon',index:'nbr_doublon', width:100}
  14.     ],
  15.     pager: '#jqPager',
  16.         rowNum: 20,
  17.         rowList: [10, 20, 30, 50],
  18.         height: '100%',
  19.         autowidth: true,
  20.         shrinkToFit: true,
  21.         viewrecords: true,
  22.         ignoreCase: true,
  23.         loadonce: true,
  24.         jsonReader: {
  25.             repeatitems: false,
  26.             id: 'id',
  27.             root: 'rows',
  28.             subgrid: {
  29.                 repeatitems: false,
  30.                 id: 'id',
  31.                 root: 'rows',
  32.             }
  33.         },
  34.         subGrid: true,
  35.         subGridUrl: fullBaseUrl+'/candidats/doublons_sub_ws.json',
  36.         subGridModel: [{
  37.             name: ['ID', 'Nom', 'Prénom'],
  38.             width: [50, 100, 100],
  39.             params: ['nom', 'prenom', 'date_naissance'],
  40.             mapping: ['id', 'nom', 'prenom']
  41.         }],
  42. });
  43. $('#jqList').jqGrid('navGrid','#jqPager',{edit:false,add:false,del:false});
  44. $('#jqList').jqGrid('filterToolbar',{stringResult: true, searchOnEnter: false});
  45. $('#jqList').jqGrid('navButtonAdd', '#jqPager', {
  46.     caption: '',
  47.     title: 'Afficher la barre de recherche rapide',
  48.     buttonicon: 'ui-icon-pin-s',
  49.     onClickButton: function () {
  50.         this.toggleToolbar();
  51.         if ($.isFunction(this.p._complete)) {
  52.             if ($('.ui-search-toolbar', this.grid.hDiv).is(':visible')) {
  53.                 $('.ui-search-toolbar', this.grid.fhDiv).show();
  54.             } else {
  55.                 $('.ui-search-toolbar', this.grid.fhDiv).hide();
  56.             }
  57.             this.p._complete.call(this);
  58.             fixPositionsOfFrozenDivs.call(this);
  59.         }
  60.     }
  61. });
  62. $('#jqList')[0].toggleToolbar();
  63. function actionFormatter(cellValue, options) {
  64.     var icons = '';
  65.     icons += '<a href="'+fullBaseUrl+'/candidats/doublon_delete/'+options.rowId+'" title="Supprimer" onclick="return confirm(\'Etes-vous sûr de vouloir supprimer ce doublon ?\');"><span class="ui-icon ui-icon-trash"></span></a>';
  66.     return icons;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement