Announcement

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

    ListGrid always performs another fetch when less then three columns

    I've come across very strange fetch policy.
    When ListGrid has less then three columns it automatically performs another fetch. First one for records 0-75, and another for next 75 records.
    I've tried changing multiple options like cache params, datapagesize, autoFetchData, drawAhead and many others.
    It even does not matter if there are many fields that user can pick and show.
    Two fetches are performed when grid displays one or two columns. Adding third one that will be shown make it work properly again.

    Code:
            RestDataSource ds = new RestDataSource();
            ds.setDataFormat(DSDataFormat.JSON);
            ds.setJsonPrefix("");
            ds.setJsonSuffix("");
            ds.setFetchDataURL("clients,fetch");
    
            DataSourceIntegerField fieldId = new DataSourceIntegerField("id");
            fieldId.setPrimaryKey(true);
            ds.addField(fieldId);
    
            ds.addField(new DataSourceTextField("login"));
            ds.addField(new DataSourceTextField("name"));
            ds.addField(new DataSourceTextField("surname"));
            ds.addField(new DataSourceTextField("address"));
            ds.addField(new DataSourceTextField("address_house"));
            ds.addField(new DataSourceTextField("address_apart"));
            ds.addField(new DataSourceTextField("city"));
    
            ListGrid listGrid = new ListGrid();
            listGrid.setWidth100();
            listGrid.setHeight100();
            listGrid.setDataSource(ds);
            listGrid.setAutoFetchData(true);
            listGrid.setCanPickOmittedFields(true);
    
            listGrid.setFields(
    //                new ListGridField("id"),
                    new ListGridField("login")
    //                new ListGridField("name")
            );
    
            this.addChild(listGrid);
    What can I do, to prevent this next fetch to be performed??

    Tested on SmartGWT Version: v12.0p_2019-08-22
    Best regards.
    Mariusz Goch

    #2
    Hi pH4Lk0n,

    might be related to setDrawAllMaxCells(), if you have less than 125, but more than 83 rows in total.

    Best regards
    Blama

    Comment


      #3
      Hi Blama

      Yes, that's it. Thank you very much.
      Lost all day to this. How could I not see this setting.

      Best regards
      Mariusz Goch

      Comment


        #4
        Blama, you're the best. :)
        Last edited by mathias; 22 Aug 2019, 11:01.

        Comment


          #5
          The use of setDrawAllMaxCells() is just a workaround for this case and it should not be required. However, we can't reproduce the issue locally, so perhaps there must be some additional code that is generating the issue and is not posted here. Could you please provide a complete test case so that we can test it in order to reproduce the issue?

          Regards
          Isomorphic Software

          Comment


            #6
            I've posted complete test case. But according to docs of setDrawAllMaxCells() it works as expected. Default value is 250. So when grid has only 1 column and it fetches 75 records and displays only 75 cells that is less than 250. Maybe default value should be less or algorithm should consider number of columns.
            In above example if datasource has more then 75 records and only one column set to ListGrid additional fetch starts right after first one finishes. Adding two more columns or setting setDrawAllMaxCells(0) prevent this from happening.
            Best regards
            Mariusz Goch

            Comment

            Working...
            X