Bonsoir,
Bon ben j'ai essayé ça:
ajouté dans etitablegrid.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| function DateTimeCellEditor(a) {
this.init(a)
}
DateTimeCellEditor.prototype = new TextCellEditor();
DateTimeCellEditor.prototype.displayEditor = function (a, b) {
TextCellEditor.prototype.displayEditor.call(this, a, b);
$(b).datetimepicker({
dateFormat: this.editablegrid.dateFormat == "EU" ? "dd/mm/yy" : "mm/dd/yy",
beforeShow: function () {
this.onblur_backup = this.onblur;
this.onblur = null
},
onClose: function (c) {
if (c != "") {
this.celleditor.applyEditing(b.element, c)
} else {
if (this.onblur_backup != null) {
this.onblur_backup()
}
}
}
}).datetimepicker("show")
}; |
ET
a.cellRenderer = a.enumProvider ? new EnumCellRenderer() : a.datatype == "integer" || a.datatype == "double" ? new NumberCellRenderer() : a.datatype == "boolean" ? new CheckboxCellRenderer() : a.datatype == "email" ? new EmailCellRenderer() : a.datatype == "website" || a.datatype == "url" ? new WebsiteCellRenderer() : a.datatype == "datetime" ? new DateTimeCellEditor() : new CellRenderer();
Dans mon fichier php j'ai mis :
$grid->addColumn('Date_instal', 'Installation', 'datetime');
et dans mon html j'ai:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="javascript/jquery-ui-timepicker-addon.js"></script>
<script src="javascript/editablegrid.js"></script>
</head>
<body>
<script src="javascript/demo.js" ></script>
<script type="text/javascript">
window.onload = function() { editableGrid.onloadXML("datasource/status_admin.php?id_status=<?php echo $id_status; ?>");
};
</script> |
Mais ça ne fonctionne pas, dans la console firebug j'ai une erreur:
TypeError: columns[j].cellRenderer._render is not a function
[Stopper sur une erreur]
columns[j].cellRenderer._render(i, j, td, getValueAt(i, j))
Mais en ait je me demande si seulement cela est possible car dans la notice de timepicker il faut ajouter ceci:
$('#basic_example_1').datetimepicker();
Ce qui insinue que le script est lié à l'id de mon input. Or je ne sais pas comment nommé l'id de l'input puisque c'est un tableau dont les cellules se transforme en input au clic???
Bref, si quelqu'un pouvait me venir en aide parceque là ça devient vraiment trop gros pour moi...
Mille merci
Partager