I'm trying to implement shield ui Popup Editing with wicket and java. My html and java code:
<div id="grid2">
<script type="text/javascript">
$(document).ready(function () {
$("#grid2").shieldGrid({
dataSource: {
/*remote: {
//read: ""
//return "Leyendo";
},*/
data: "datasource",
schema: {
fields: {
ID: { path: "ID", type: Number },
Name: { path: "Name", type: String },
Age: { path: "Age", type: Number },
BirthDate: { path: "BirthDate", type: Date },
Active: { path: "Active", type: Boolean }
}
}
},
paging: {
pageSize: 15
},
rowHover: true,
columns: [
{ field: "Name", title: "Nombre"},
{ field: "Age", title: "Direccion", width: "100px" },
{ field: "BirthDate", title: "Fecha", format: "{0:dd/MM/yyyy}" },
{ field: "Active", title: "Activo", width: "70px" },
{
width: 150,
title: "Modificar ",
buttons: [
{ commandName: "edit", caption: "Editar" },
{ commandName: "delete", caption: "Eliminar" }
]
}
],
editing: {
enabled: true,
mode: "popup",
confirmation: {
"delete": {
enabled: true,
template: function (item) {
return "Eliminar abastecimiento con id '" + item.Name + "'?";
}
}
}
},
toolbar: [
{
buttons: [
{ commandName: "insert", caption: "Agregar" }
],
position: "top"
}
]
});
});
</script>
</div>
<p></p>
</div>
Java's code is:
DataSource datasource = new DataSource("datasource");
DataSourceOptions options = datasource.getOptions();
options.setData(
new HashMap() {{
put("ID", 1);
put("Name", "Item1");
put("Age", 45);
put("BirthDate", "16/08/2006");
put("Active", false);
}},
new HashMap() {{
put("ID", 2);
put("Name", "Item2");
put("Age", 45);
put("BirthDate", "16/08/2006");
put("Active", false);
}},
new HashMap() {{
put("ID", 3);
put("Name", "Item3");
put("Age", 45);
put("BirthDate", "16/08/2006");
put("Active", false);
}},
new HashMap() {{
put("ID", 4);
put("Name", "Item4");
put("Age", 45);
put("BirthDate", "16/08/2006");
put("Active", false);
}}
);
add(datasource);
//END testing shieldui
There is no documentation about implementing datasource for grid editting so I've tried all combinations using remote and datat tags in order to get the data from may java code. No success.
When I deploy my war I get a grid whith several rows with current date in field BirthData but all other fields empty.
I dont know where that data comes, if I remove data:"datasource" from html file i get only grid headers, no data.
Please any suggestion will be grateful.