Announcement

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

    Client side criteria on TileGrid

    The criteria seem not to work, since I am getting all records back, ignoring setInitialCriteria().

    Edit: fetchData(c) seems to work. But setInitialCriteria() not ?

    TestingModule:
    Code:
    public void onModuleLoad() {
    
            VStack vStack = new VStack(20);
            vStack.setWidth100();
    
            final TileGrid tileGrid = new TileGrid();
            tileGrid.setTileWidth(158);
            tileGrid.setTileHeight(225);
            tileGrid.setHeight(400);
            tileGrid.setID("boundList");
            tileGrid.setCanReorderTiles(true);
            tileGrid.setShowAllRecords(true);
            tileGrid.setDataSource(AnimalXmlDS.getInstance());
            tileGrid.setAutoFetchData(true);
            tileGrid.setAnimateTileChange(true);
    
            DetailViewerField commonNameField = new DetailViewerField("commonName");
            commonNameField.setCellStyle("commonName");
    
            DetailViewerField lifeSpanField = new DetailViewerField("lifeSpan");
            lifeSpanField.setCellStyle("lifeSpan");
            lifeSpanField.setDetailFormatter(new DetailFormatter() {
                public String format(Object value, Record record, DetailViewerField field) {
                    return "Lifespan: " + value;
                }
            });
    
            DetailViewerField statusField = new DetailViewerField("status");
            tileGrid.setFields(commonNameField, lifeSpanField, statusField);
    
            vStack.addMember(tileGrid);
    
            Criteria c = new Criteria();
            c.addCriteria("status", "Not Endangered");
            tileGrid.setInitialCriteria(c);
            
            HLayout hLayout = new HLayout(10);
            hLayout.setHeight(22);
    
            vStack.addMember(hLayout);
    
            vStack.draw();
        }
    Using smartgwt 6.0p 06.04 power

    #2
    Have you been able to reproduce the issue ?

    Comment


      #3
      initialCriteria was added to DBC principally for use in ListGrid, where it has special applicability due to the FilterEditor. For the TileGrid, there doesn't appear to be a reason to use this API. For completeness, we'll make it work there too, but it should not be a blocker for you.

      Comment


        #4
        It is difficult to know when an API call is working or not (for example in this case).
        So when using it, I was wondering why the criteria were being ignored so I had to create a test case for isolating the problem.
        Of course, I could have used fetchData(c) with autoFetchCriteria(false), but how to know that setInitialCriteria() is not working?
        I know that now, after isolating the problem creating a test case. So now I use that. But only after creating the test case.

        So yes, this is not a blocker for me now (after isolating the problem), but I still think that if an API call is available then it should work :-)
        Last edited by edulid; 20 Apr 2016, 00:48.

        Comment


          #5
          Obviously. That's why we are going to support it, as we've already said.

          Comment


            #6
            Well, after trying to reproduce your problem we found out that the initialCriteria is working in TileGrids, but there is a problem in the example code that you provided. When we ran the example we got a warning in the developer console (it also can be seen in the javascript console):
            WARN:Log:Cannot change configuration property 'initialCriteria' to [object Object] now that component boundList has been created.

            This happens when you try to modify an attribute annotated as IR to a widget that has been initialized.
            If we change the code to set the initialCriteria just before adding the TileGrid to the VStack with addMember, everything works as expected.

            Comment

            Working...
            X