Listgrid usage help

I’m trying to modify the Showcase Grid example called “printing” so that instead of using DetailViewer() it creates another ListGrid() instead. Unfortunately I haven’t been successful. I’m able to create and draw the grid but I can not seem transfer the data to it. Does anyone have any ideas? Thanks in advance for the help.

Please post a stanalone test case.

Hi Art,

The properties are very nearly identical, it’s a matter of switching from ListGridField et al to DetailViewerField. But we can’t help further until we see what code you’re trying and what specific issue you’re having.

I’m posting the relevant portition of the code. Thanks.

 //       final DetailViewer printViewer = new DetailViewer();
 //       printViewer.setDataSource(countryDS);
 //       printViewer.setWidth100();
 //       printViewer.setMargin(15);
 //       printViewer.setEmptyMessage("Select a country to view its details");
 
 // test area
        final ListGrid printGrid1 = new ListGrid();
        printGrid1.setHeight(150);
        printGrid1.setAlternateRecordStyles(true);

        printGrid1.setDataSource(countryDS);

// ****************
        
        final ListGrid printGrid = new ListGrid();
        printGrid.setHeight(150);
        printGrid.setAlternateRecordStyles(true);

        printGrid.setDataSource(countryDS);

        ListGridField countryCode = new ListGridField("countryCode", "Code", 50);
        ListGridField countryName = new ListGridField("countryName", "Country");
        ListGridField capital = new ListGridField("capital", "Capital");
        ListGridField continent = new ListGridField("continent", "Continent");
        ListGridField government = new ListGridField("government", "Government");
        printGrid.setFields(countryCode, countryName, capital, continent);
        printGrid1.setFields(countryCode, countryName, capital, government, continent);
        printGrid.addRecordClickHandler(new RecordClickHandler() {
            public void onRecordClick(RecordClickEvent event) {
                printGrid1.addData(event.getRecord());
                printGrid1.draw();
            }
        });

        SectionStackSection countriesSection = new SectionStackSection("Countries");
        countriesSection.setExpanded(true);
        countriesSection.addItem(printGrid);
        printStack.addSection(countriesSection);

        SectionStackSection detailsSection = new SectionStackSection("Country Details");
        detailsSection.setExpanded(true);
        //detailsSection.addItem(printViewer);
        detailsSection.addItem(printGrid1);
        printStack.addSection(detailsSection);

Having given the grid a DataSource, either setAutoFetchData(true) or call fetchData() to actually load data from the DataSource.