Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Server APIs safe to use? (DSResponse.setFieldValue() and setAffectedRows())

    Hi Isomorphic,

    I'm struggling to create a mocked server side DSResponse to use with addRelatedUpdates() in order to remove one row from the cache on the client side.

    While trying I found DSResponse.setFieldValue() and setAffectedRows() which are not documented under http://www.smartclient.com/smartgwte...SResponse.html. Are they safe to use?

    Thanks,
    Blama

    #2
    For anyone insterested in how to build a serverside DSResponse from scratch, I solved it this way:

    Code:
    fetchResponse = new DSResponse(rpcManager.getDataSource(dataSource)) {
    	{
    		// Search for setData in Server Showcase source (sample\showcase\SERVER!) or see
    		// http://www.smartclient.com/smartgwtee/server/javadoc/com/isomorphic/datasource/DSResponse.html#setData%28java.lang.Object%29
    		setOperationType("remove");
    		setSuccess();
    		setTotalRows(1);
    		setStartRow(1);
    		setEndRow(1);
    
    		[B]List<Map<String, Object>> l = new  ArrayList<Map<String, Object>>();
    		Map<String, Object> m = new HashMap<String, Object>();
    		m.put(fetchRequest.getDataSource().getPrimaryKey(), fetchRequest.getCriteriaValue(fetchRequest.getDataSource().getPrimaryKey()).toString());
    		l.add(m);
    		setData(l);[/B]
    	}
    The linked docs say:
    If the operationType is DataSource.OP_REMOVE, then the data is expected to be at least the primary key fields of the removed record, an as JavaScript Object.

    Comment

    Working...
    X