I would like to wire a listgrid to a datasource that uses gwt-rpc as it's transport. I would like the grid to populate with data when the page loads. I would like the grid to periodically fetch new data from the server and update existing records. I would like to connect a form to the datasource for creating new records. I would only like the new records to appear in the listgrid if my gwt-rpc call to the server is successful.
I have been using the techniques described in these two threads:
http://forums.smartclient.com/showthread.php?t=4183
http://forums.smartclient.com/showthread.php?t=3538
and have encountered a couple of problems I have been unable to work around.
The first problem is around the adding new data. I've overridden transformResponse and have a block for add requests. The problem is that I'm calling the addData method from the block for fetch requests and that method seems to asynchronously call addData. The result is there is no way for me to determine if transformResponse is being called for an addData initiated by the form submission or from fetch being called on the DataSource. This creates two problems: a) I always end up calling my gwt-rpc request to add once for each row that gets returned by a fetch and b) when the form is initiating the add I can't change the status to fail to prevent the data from going in the grid, this means even if the gwt-rpc call fails the data is already added in the grid.
The second problem is with updating data. When a fetch is called there is no way for me to determine if a record is already in the datasource. This means there is no way to know if I should call addData or updateData for reach record. Ideally there would be some way on the datasource to lookup a record by it's primary key.
I will attach the code in a followup post.
Thanks,
Benjamin
I have been using the techniques described in these two threads:
http://forums.smartclient.com/showthread.php?t=4183
http://forums.smartclient.com/showthread.php?t=3538
and have encountered a couple of problems I have been unable to work around.
The first problem is around the adding new data. I've overridden transformResponse and have a block for add requests. The problem is that I'm calling the addData method from the block for fetch requests and that method seems to asynchronously call addData. The result is there is no way for me to determine if transformResponse is being called for an addData initiated by the form submission or from fetch being called on the DataSource. This creates two problems: a) I always end up calling my gwt-rpc request to add once for each row that gets returned by a fetch and b) when the form is initiating the add I can't change the status to fail to prevent the data from going in the grid, this means even if the gwt-rpc call fails the data is already added in the grid.
The second problem is with updating data. When a fetch is called there is no way for me to determine if a record is already in the datasource. This means there is no way to know if I should call addData or updateData for reach record. Ideally there would be some way on the datasource to lookup a record by it's primary key.
I will attach the code in a followup post.
Thanks,
Benjamin
Comment