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
| dojo.require("dojo.date.locale");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dojox.grid.DataGrid");
dojo.require("dojox.grid.cells.dijit");
var jsonStore = new dojo.data.ItemFileWriteStore({ data:
{
identifier: 'matricule',
label: 'matricule',
items: [ { matricule: '810602', datedispo: '31/12/2009', lieuhab: '44000 NANTES', observations: 'null', vehicule: 'false' } ]
}
});
var formatVehicule = function(inDatum) {
switch (inDatum)
{
case 'true' : return 'OUI';
case 'false' : return 'NON';
}
}
var formatDate = function(inDatum) {
return dojo.date.locale.format(new Date(dojo.date.stamp.fromISOString(inDatum)), this.constraint);
}
var grid = null;
dojo.addOnLoad(function(){
var layout = [
{
width: 'auto',
noscroll: true,
cells: [
{ field: "matricule", name: "Matricule", width: '65px' },
]
},
{
cells: [
{ field: "datedispo", name: "Dispo.", width: '80px', editable: true, dojox.grid.cells.DateTextBox, constraint: {formatLength: 'long', selector: "date"} },
{ field: "lieuhab", name: "Lieu Hab.", width: '150px' },
{ field: "observations", name: "Observations", width: '150px' },
{
field: "vehicule",
name: "Véhicule",
width: '60px',
editable: true,
type: dojox.grid.cells.Select,
options: [ 'OUI', 'NON' ], values: [ 'true', 'false' ],
formatter: formatVehicule
},
]
}
];
grid = new dojox.grid.DataGrid({
query: { matricule: '*' },
store: jsonStore,
structure: layout
}, 'gridNode');
}); |
Partager