SmartGWT RestDataSource
2 answers
Have you looked at the source code for RestDataSource Edit and Save from Showcase ? This is a good starting point.
If you want REST on the server, I would recommend Restlet to talk to the JDBC backend. You can take the example above and connect it to your Restlets instead of XML.
+1
a source to share
Here is a general outline of what you could do if you are not using GWT and are using PHP. There would be a similar idea with java.
Define your data source in your file
isc.RestDataSource.create({
ID: "yourDS"
,fields: [
{name: "id", hidden: true, primaryKey: true}
,{name: "name", title: "field1"}
]
,dataFormat: "json"
,dataURL: "dmi/yourDMI.php"
})
Then define yourDMI.php controller file. It should have checks for all types of operations, fetch, add, delete, update
if (isset($_GET['_operationType']) && strcmp($_GET['_operationType'], "fetch") == 0) {
// do something.. return JSON response
}
if (isset($_GET['_operationType']) && strcmp($_GET['_operationType'], "add") == 0) {
// do something.. return JSON response
}
if (isset($_GET['_operationType']) && strcmp($_GET['_operationType'], "delete") == 0) {
// do something.. return JSON response
}
if (isset($_GET['_operationType']) && strcmp($_GET['_operationType'], "update") == 0) {
// do something.. return JSON response
}
0
a source to share