Announcement

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

    4.0p bug, invalid valuemap in filtereditor with setDisplayField

    Hi,

    When a listgridfield is set to display an another field with setDisplayField the options in filter editor's select list contain duplicate values. Reproducable with:

    Code:
        public Record r(Integer i, String t) {
            Record r = new Record();
            r.setAttribute("f1", "Text " + i);
            if(i != null)
                r.setAttribute("someid", i);
            if(t != null)
                r.setAttribute("title", t);
            return r;
        }
    
        public void onModuleLoad() {
            SC.showConsole();
    
            viewport = new VLayout();
            viewport.setWidth100();
            viewport.setHeight100();
            viewport.setMembersMargin(20);
    
            DataSource ds = new DataSource();
            DataSourceTextField f1f = new DataSourceTextField("f1");
            DataSourceIntegerField someidf = new DataSourceIntegerField("someid");
            DataSourceTextField tf = new DataSourceTextField("t");
            ds.setFields(f1f, someidf, tf);
            ds.setTestData(r(null, null), r(1, "title1"), r(1, "title1"), r(null, null), r(1, "title1"), r(2, "title2"));
            ds.setClientOnly(true);
    
            final ListGrid g = new ListGrid();
            g.setDataSource(ds);
            g.setWidth(500);
            g.setHeight(200);
            g.setAutoFetchData(true);
            ListGridField f1 = new ListGridField("f1");
            ListGridField someid = new ListGridField("someid");
            someid.setDisplayField("title");
            g.setFields(f1, someid);
    
            g.setShowFilterEditor(true);
            g.setFilterOnKeypress(true);
            viewport.addMember(g);
    
            viewport.draw();
        }
    When running the code above the "someid" field's filter editor shows _all_ title values from records and "someid" has only '', 1 and 2 values specified. The filtering itself seems to work so the valuemap probably just contains duplicate entries for all records.

    Using 4.0p 2013-10-22 nightly.

    br,
    Marko

    #2
    Could you please confirm is this a bug and/or is there a workaround for this issue ?

    Thanks,
    Marko

    Comment


      #3
      Hi Markok,

      I'm also facing a similar problem. If you found the solution to your problem, please share.

      Thanks,
      Javanese

      Comment


        #4
        Have you tried setting a PK in the DataSource? Maybe "someidf" field?

        Comment

        Working...
        X