Announcement

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

    Server side fetch called twice when trying to get a client only data source.

    Is it normal for Is there a way to configure the datasource so the fetch operation is only called once?

    //Client code
    public class DatasourceTester {

    public static void doLocalTest(){
    final ListGrid listGrid = new ListGrid();
    DataSource datasource = DataSource.get("testDS");
    datasource.getClientOnlyDataSource(new Criteria(), new ClientOnlyDataSourceCallback() {
    @Override
    public void execute(DataSource localDataSource) {
    listGrid.setDataSource(localDataSource);
    }
    });
    }
    }

    //Server side fetch - being called twice
    public DSResponse fetch(DSRequest request){
    DSResponse response = new DSResponse();
    List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
    response.setData(results);
    return response;
    }

    //DS config
    <DataSource ID="testDS" serverType="generic">
    <serverObject className="com.dotomi.zisa.beans.TestBean" methodName="fetch"/>
    <fields>
    <field name="test_field" type="text" hidden="false" required="true"/>
    </fields>
    </DataSource>

    #2
    This sample code looks like it would result in a single server side fetch against "testDS", and then construct a clientOnly dataSource from it, which then gets applied to the ListGrid - so the ListGrid's fetches would be satisfied from the clientOnly dataSource's cache - so this would seem to not require two server fetches.

    If you'd like us to take a look, can you please flesh this out a little:
    - Let us know which version of SGWT you're testing against (and be sure to test the latest Nightly build for your branch)
    - show us the EntryPoint class which actually executes doLocalTest() [in other words, give us a full runnable set of code]

    - also - presumably you're seeing the double fetch in the server logs (correct?) - can you show us the relevent portion of the logs?

    Regards
    Isomorphic Software

    Comment


      #3
      Attached are files including the client EntryPoint class that exhibits the multiple fetch behavior
      TestBean.java testDS.ds.xml TestApp.java

      Comment


        #4
        we are using smartgwt power version,
        4.1-p20150730 but have tried a more recent 5.0-p version which behaves the same..

        Comment


          #5
          Thanks for the test case - we do see this and are looking into it.

          Regards
          Isomorphic Software

          Comment


            #6
            We've made a change to address this issue. The fix will be present in the next nightly build (Jan 9 or above) in the 4.1p, 5.0p, 5.1p branches

            Regards
            Isomorphic Software

            Comment

            Working...
            X