SmartGwt 5.0
Chrome Version 40.0.2214.115 (64-bit)
Hey guys,
I have a bunch of list grids. Each grid is responsible for showing records for a specific product id (e.g. one listgrid for product id=10, another for product id = 20 etc). I would like to have just one datasource, which fetches all data for all products. When the grid for product id=10 requests data, it will receive only those records from the datasource.
So far, I have managed to make this work when the grids are fetching data. But when I manually add a new row in one of the grids, then the new record is added to all other list grids. How can I make sure this will not happen?
I'm using the GwtRpcDataSource datasource implementation which floats around on the internet, e.g. here: https://code.google.com/p/smartgwt-e...urce.java?r=12
In the executeAdd method, I'm dealing with the response in this way:
The method executeAdd is only invoked once (as expected), but processing the response, makes the new data appear on all list grids. Can anyone tell me what Im doing wrong?
Chrome Version 40.0.2214.115 (64-bit)
Hey guys,
I have a bunch of list grids. Each grid is responsible for showing records for a specific product id (e.g. one listgrid for product id=10, another for product id = 20 etc). I would like to have just one datasource, which fetches all data for all products. When the grid for product id=10 requests data, it will receive only those records from the datasource.
So far, I have managed to make this work when the grids are fetching data. But when I manually add a new row in one of the grids, then the new record is added to all other list grids. How can I make sure this will not happen?
I'm using the GwtRpcDataSource datasource implementation which floats around on the internet, e.g. here: https://code.google.com/p/smartgwt-e...urce.java?r=12
In the executeAdd method, I'm dealing with the response in this way:
Code:
protected void executeAdd(final String requestId, final DSRequest request, final DSResponse response) { ListGridRecord record = new ListGridRecord(request.getData()); ... stuff going on here ... response.setData(data); response.setStatus(DSResponse.STATUS_SUCCESS); processResponse(requestId, response); }
Code:
public abstract class GwtRpcDataSource extends DataSource { public GwtRpcDataSource () { setDataProtocol (DSProtocol.CLIENTCUSTOM); setDataFormat (DSDataFormat.CUSTOM); setClientOnly (false); } @Override protected Object transformRequest (DSRequest request) { String requestId = request.getRequestId (); DSResponse response = new DSResponse (); response.setAttribute ("clientContext", request.getAttributeAsObject ("clientContext")); response.setStatus (0); switch (request.getOperationType ()) { case FETCH: executeFetch (requestId, request, response); break; case ADD: executeAdd (requestId, request, response); break; case UPDATE: executeUpdate (requestId, request, response); break; case REMOVE: executeRemove (requestId, request, response); break; default: // Operation not implemented. break; } return request.getData (); } protected abstract void executeFetch (String requestId, DSRequest request, DSResponse response); protected abstract void executeAdd (String requestId, DSRequest request, DSResponse response); protected abstract void executeUpdate (String requestId, DSRequest request, DSResponse response); protected abstract void executeRemove (String requestId, DSRequest request, DSResponse response); }