Hi,
I am currently on SmartClient Version: v10.0p_2014-10-10/EVAL Development Only
I try to to setup a RestDataSource with REST server app : Django REST Framework.
While it was easy to fetch records or create a new one, I can't find a way to get my RestDataSource to work for others operationType.
To edit or delete a record I need to add the primary key (id) to the dataURL. I am currently focused on the "remove" operation.
dataURL is "/rapi/clients/" and I need to have "/rapi/clients/<id>" when I want to edit/delete a record.
Thank you
I am currently on SmartClient Version: v10.0p_2014-10-10/EVAL Development Only
I try to to setup a RestDataSource with REST server app : Django REST Framework.
While it was easy to fetch records or create a new one, I can't find a way to get my RestDataSource to work for others operationType.
To edit or delete a record I need to add the primary key (id) to the dataURL. I am currently focused on the "remove" operation.
dataURL is "/rapi/clients/" and I need to have "/rapi/clients/<id>" when I want to edit/delete a record.
Code:
isc.RestDataSource.create({
ID:"client",
fields: [
{name:"id", type:"integer", title:"id"},
{name:"name", type:"text", title:"Nom", required:true}
],
dataFormat:"json", DSDataFormat:"json",
sendMetaData: false,
recordXPath: "data",
dataURL:"/rapi/clients/",
transformRequest: function(dsRequest) {
dsRequest.httpHeaders = {"Accept":"application/json", "X-CSRFToken": CSRFToken};
if(dsRequest.operationType == "remove") {
// Add the id to dataURL, how ?
}
return this.Super("transformRequest", arguments);
},
operationBindings:[
{operationType:"remove", dataProtocol:"getParams", requestProperties:{httpMethod:"DELETE"}}
]
});
Comment