Announcement

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

    setEditorProperties, setFilterEditorProperties bugs in 4.0p

    Hello,

    I'm trying to set a value map to listgrid's filter editor field and it seems it is not working if it is set after the filter editor is once initialized.

    Code:
        public ListGridRecord r(Integer i, String t) {
            ListGridRecord r = new ListGridRecord();
            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);
            final ListGridField f1 = new ListGridField("f1");
            final ListGridField someid = new ListGridField("someid");
            someid.setDisplayField("title");
            g.setFields(f1, someid);
    
            g.setShowFilterEditor(true);
            g.setFilterOnKeypress(true);
            viewport.addMember(g);
    
            Button b = new Button("valuemap");
            b.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    Map vm = new HashMap();
                    vm.put("1", "foo");
                    vm.put("2", "bar");
                    someid.setFilterEditorValueMap(vm);
                }
            });
            viewport.addMember(b);
    
            viewport.draw();
        }
    Pressing the valuemap-button in above code does nothing. Is there a way to change the valuemap after the data in grid has been rendered ? Calling redraw on grid or on the filter editor has no effect.

    SmartClient Version: v9.0p_2013-10-22/LGPL Development Only (built 2013-10-22).

    br,
    Marko
    Last edited by markok; 24 Oct 2013, 02:40. Reason: Remove original question, added test case

    #2
    You could use an optionDataSource which returns different results at different times.

    But you need to clarify the situation, because changing the valueMap on the fly has implications for what happens to the current criteria, and therefore what happens to the data.

    Comment

    Working...
    X