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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
| <script type="text/javascript">
$(document).ready(function () {
oTable = $('#myDataTable').dataTable({
"sDom": '<"H"C<"clear">Wlfr>t<"F"ip>', //permet d'afficher ou cacher des colonnes
"oColVis": { "bRestore": true,
"activate": "mouseover" // l'option s'affiche lorsque la souris passe sur le bouton !!
},
//"bFilter": true, // cacher la barre de recherche
"bJQueryUI": true, // améliore l'ergonomie de la table
"sPaginationType": "full_numbers", // permet la pagination complète
"bServerSide": true, // Méthode http de récupération de données AJAX
"sAjaxSource": "BirdsADM/AjaxHandler", // accéder a la database
//"sServerMethod": "GET", // ou "POST"
"bProcessing": true,
"oLanguage": { "sUrl": "Content/french.txt" }, // dictionnaire
"sScrollY": "380", // affiche que 10 lignes, scroller pour voir le reste
"bScrollCollapse": true, // permet de scroller
"aoColumns": [
{ "sTitle": "Référence PV" },
{ "sTitle": "Indice" },
{ "sTitle": "Type" },
{ "sTitle": "Sous-Type" },
{ "sTitle": "N°Constructeur" },
{ "sTitle": "Publication" },
{ "sTitle": "Date Publication" },
{ "sTitle": "ID PV REF" },
{ "sTitle": "Type PV Lib" }
]
}).makeEditable({
sAddNewRowFormId: "formAddNewPV",
sDuplicateURL: "/BirdsADM/Duplicate",
sUpdateURL: "/BirdsADM/Edit",
sDeleteURL: "/BirdsADM/Delete",
sAddURL: "/BirdsADM/Create",
fnOnDeleting: function (tr, id, fnDeleteRow) {
var position = oTable.fnGetPosition($(".row_selected").get(0)); // récupérer la ligne selectionnée
var IDPVREF = parseInt(oTable.fnGetData(position)[7]); // récupérer l'IDPVREF
jConfirm('Souhaitez vous supprimer le PV n°' + id, 'Confirm Delete', function (confirmed) {
if (confirmed) {
fnDeleteRow(IDPVREF);
}
});
return false;
},
fnOnNewRowPosted: function (data) {
if (data.indexOf("Error", 0) == 0) {
alert(data)
return false;
}
else {
alert(data)
return true;
}
},
"aoColumns": [
null,
{
indicator: 'Saving country...',
tooltip: 'Clic to edit country',
type: 'textarea',
onblur: 'cancel',
submit: 'Appliquer'
},
{
indicator: 'Saving country...',
tooltip: 'Click to edit country',
type: 'textarea',
onblur: 'cancel',
submit: 'Appliquer'
},
{
indicator: 'Saving country...',
tooltip: 'Click to edit country',
type: 'textarea',
onblur: 'cancel',
submit: 'Appliquer'
},
{
indicator: 'Saving country...',
tooltip: 'Click to edit country',
type: 'textarea',
onblur: 'cancel',
submit: 'Appliquer'
},
{
indicator: 'Saving country...',
tooltip: 'Click to edit country',
type: 'textarea',
onblur: 'cancel',
submit: 'Appliquer'
},
{
indicator: 'Saving country...',
tooltip: 'Click to edit country',
type: 'textarea',
onblur: 'cancel',
submit: 'Appliquer'
},
null,
{
indicator: 'Saving country...',
tooltip: 'Click to edit country',
type: 'textarea',
onblur: 'cancel',
submit: 'Appliquer'
}
],
oDeleteRowButtonOptions:
{
label: "Supprimer",
icons:
{
primary: 'ui-icon-trash'
}
},
oDuplicateRowButtonOptions:
{
label: "Dupliquer",
icons:
{
primary: 'ui-icon-trash'
}
},
oAddNewRowButtonOptions:
{
label: "Ajouter",
icons:
{
primary: 'ui-icon-plus'
}
}
});
$("#formAddNewPV").dialog({ width: '1000px' })
$("input[data-autocomplete-source]").each(function () {
var target = $(this);
target.autocomplete({
source: target.attr("data-autocomplete-source"),
position: { // pour forcer la liste a être sous la barre de recherche
my: 'top',
at: 'bottom'
},
minLength: 0,
select: function (event, ui) {
//alert(ui.item.value);
}
});
});
});
</script> |
Partager