Announcement

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

    I need an example of DataSource.updateCaches

    what's the point, no one will help anyway.
    Last edited by cliff.newton; 24 Nov 2010, 09:51.

    #2
    Here you are the code I ended up with following Isomorphic's suggestion

    Code:
    //a criteria to fetch only one row
    final Criteria criteria = new Criteria (MY_FIELD_NAME, Integer.toString (id));
    //fetched the data
    MyDataSource.getInstance ().fetchData (criteria, new DSCallback () {
    	@Override
    	public void execute (final DSResponse response, final Object rawData, final DSRequest request) {
    		request.setOperationType (DSOperationType.UPDATE); // mimic an UPDATE operation
    		//force (forge?) a cache update, to reflect the fresh data copy
    		MyDataSource.getInstance ().updateCaches (response, request);
    
    		//you can use the fetched data for other purposes, if needed...
    		final Record[] data = response.getData ();
    	}
    });
    It refreshes the local cache data only for the row requested using an appropriate criteria.
    I hope SmartGWT 2.3 and SmartClient 8 will have a good documentation even for this feature (I think they are working on a huge documentation revamp).
    Hope it helps.

    Cheers
    Davide

    P.S.: If I was in you, I'd never say I'm weary of reading documentation while I am asking something to Isomorphic... this could simply lead to no replies;-)
    Last edited by d.cavestro; 25 Nov 2010, 03:58.

    Comment


      #3
      How to use UpdateCaches to refresh single record from the database (I know primary key value).

      code bellow forces full listgrid refresh:
      var dsResponse = isc.DSResponse; dsResponse.invalidateCache = true; mydatasource.updateCaches(dsResponse);

      is it possible to refresh single record without user notifying listgrid refresh?

      Comment


        #4
        I can verify this approach works... See thread http://forums.smartclient.com/showthread.php?p=65796#post65796

        Jean-Pierre

        Comment

        Working...
        X