Announcement

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

    ToolStripMenuButton per rootnode

    I have a simplistic datasource:
    Menu(id,name,parent,sequence)

    Now I want to create toolstripmenubuttons for each rootnode that is available. (to create a 'normal' top menu bar). I can't figure out how to do this.

    I've tried the code below, to no avail:
    Code:
    final DataSource ds = DataSource.get("MenuDS");
    ds.fetchData(new AdvancedCriteria("parent",OperatorId.IS_NULL), new DefaultCallback(){
    	@Override
    	protected void onResponseResult(Record[] data) {
    		for(final Record record:data){
    			addMember(new ToolStripMenuButton(record.getAttribute("name"),
    				new Menu(){{
    					setData(new ResultTree(){{
    						setDataSource(getMenuDataSource());
    						setRootValue(record.getAttributeAsInt("id"));
    					}});
    				}}
    			));
    		}		
    	}
    },new DSRequest(){{
    	setSortBy(new SortSpecifier[]{new SortSpecifier("sequence", SortDirection.ASCENDING)});
    }});
Working...
X