SmartGWT pro 6.0/6.1
I am trying to send a parameter along with a delete operation on a DataSource. It's a user comment for reason for deleting, so i do not want it to be a part of the datasource.
I am a little bit puzzled as to how parameters are sent in the delete dsrequest
1. If i use "setParams" on the req above, i can then get at the parameter on the server:
But, DSRequest.getparameter("text") does not work on the server, as one might expect. Only if i do DSRequest.getContext().request.getParameter("text") can i get at it.
2. I tried setCriteria, and this is pretty confusing to me:
--I get the "id" field on the server by DSRequest.getFieldValue("id"), but when i debug, i see that it actually comes in through "clientSuppliedCriteria".
So, it turns out that if i do
req.setCriteria(new Criteria("text", theText));
in the client code above, my dsRequest.getFieldValue("id") call on the server now returns null!
To me, it seems strange that manually setting the criteria for the dsrequest on a DataSource.removeData call. After all, the method takes the record as a parameter. I can of course also set the "id"
as an additional parameter when i set the criteria, but why would i then need to send in the actual record?
So, my questions are:
1. Am i missing something regarding the DSRequest.getContext().request.getParameter()? Don't you think that the API would make more sense if i could get the parameter directly in DSRequest.getParameter()?
2. is setting the criteria manually making the "id" disappear expected behaviour?
3. to send a custom parameter in the removeData request, is my only option setParams?
4. Don't you agree that it's a bit confusing that setting the criteria causes getFieldValue to suddenly become null. It's not really logical to me, nor is it documented?
Thoughts much appreciated! :)
I am trying to send a parameter along with a delete operation on a DataSource. It's a user comment for reason for deleting, so i do not want it to be a part of the datasource.
I am a little bit puzzled as to how parameters are sent in the delete dsrequest
Code:
DSRequest req = new DSRequest(); ds.removeData(record, new MyCallback() { @Override public void doExecute(ResponseData rData, DSResponse dsResponse, Object o, DSRequest dsRequest) { //do stuff } }, req);
Code:
LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); params.put("text", theText); req.setParams(params);
2. I tried setCriteria, and this is pretty confusing to me:
--I get the "id" field on the server by DSRequest.getFieldValue("id"), but when i debug, i see that it actually comes in through "clientSuppliedCriteria".
So, it turns out that if i do
req.setCriteria(new Criteria("text", theText));
in the client code above, my dsRequest.getFieldValue("id") call on the server now returns null!
To me, it seems strange that manually setting the criteria for the dsrequest on a DataSource.removeData call. After all, the method takes the record as a parameter. I can of course also set the "id"
as an additional parameter when i set the criteria, but why would i then need to send in the actual record?
So, my questions are:
1. Am i missing something regarding the DSRequest.getContext().request.getParameter()? Don't you think that the API would make more sense if i could get the parameter directly in DSRequest.getParameter()?
2. is setting the criteria manually making the "id" disappear expected behaviour?
3. to send a custom parameter in the removeData request, is my only option setParams?
4. Don't you agree that it's a bit confusing that setting the criteria causes getFieldValue to suddenly become null. It's not really logical to me, nor is it documented?
Thoughts much appreciated! :)
Comment