I'm using SmartGWT/SmartClient LGPL, I can't use the Pro, due to project ties.
I would like to create a RestDataSource from a jdbc connection, to be exposed from the server to the SmartGWT client.
How could it be done?
Any help is greatly appreciated.
Have you had a look at the source code for the RestDataSource Edit & Save example from the Showcase? It's a good starting point.
If you want REST on the server I'd recommend Restlet talking to a JDBC backend. You could take the example above and wire it up to your Restlets instead of the XML.
Here's a general outline of what you could do if not using GWT and using PHP. Would be similar idea with java.
Define your DataSource 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 the operation types, 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
}