Hi,
I am using the below DataSource to bind to a list grid. While editing gird with listgrid.setCanEdit(true); I need to get the old values. I have read trough the posts here and also the documentations on ClientDataIntegration, DataSource, transformRequest RestDataSource etc. Still I am not able to get the oldValue and DSRequest dosen't seem to have the oldValue method.
Can anyone pls point what I am missing here.
I am using the below DataSource to bind to a list grid. While editing gird with listgrid.setCanEdit(true); I need to get the old values. I have read trough the posts here and also the documentations on ClientDataIntegration, DataSource, transformRequest RestDataSource etc. Still I am not able to get the oldValue and DSRequest dosen't seem to have the oldValue method.
Can anyone pls point what I am missing here.
Code:
public class OrgDS extends RestDataSource {
private static OrgDS instance = null;
public static OrgDS getInstance() {
if (instance == null) {
instance = new OrgDS("orgDS_XML");
}
return instance;
}
@Override
public Object transformRequest(DSRequest dsRequest)
{
if (dsRequest.getOperationType().equals(DSOperationType.UPDATE))
{
String strOrgId = JSOHelper.getAttribute(dsRequest.getData(), "orgId");
String strdesc = JSOHelper.getAttribute(dsRequest.getData(), "orgDescription");
dsRequest.setActionURL(Update URL);
}
return super.transformRequest(dsRequest);
}
public OrgDS(String id) {
setID(id);
DataSourceIntegerField pkField = new DataSourceIntegerField("pk");
pkField.setHidden(true);
pkField.setPrimaryKey(true);
DataSourceField orgIDField = new DataSourceField("orgId", FieldType.TEXT,"ID");
DataSourceField orgNameField = new DataSourceField("orgName", FieldType.TEXT, "Organization");
DataSourceField orgDescField = new DataSourceField("orgDescription", FieldType.TEXT, "Description");
setFields(orgIDField, orgNameField, orgDescField);
OperationBinding oppFetch = new OperationBinding();
oppFetch.setDataFormat(DSDataFormat.XML);
oppFetch.setOperationType(DSOperationType.FETCH);
oppFetch.setDataProtocol(DSProtocol.GETPARAMS);
oppFetch.setRecordXPath("/XDocument/XOrganization");
oppFetch.setDataURL(Fetch URL);
OperationBinding oppUpdate = new OperationBinding();
oppUpdate.setDataFormat(DSDataFormat.XML);
oppUpdate.setOperationType(DSOperationType.UPDATE);
oppUpdate.setDataProtocol(DSProtocol.GETPARAMS);
//oppUpdate.setDataURL(Update URL);
setOperationBindings(oppFetch,oppUpdate);
}
}
Comment