Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Specify details values in ListGrid expansion?

$
0
0
Hello!

I'd like to specify the items that are displayed when expanding a ListGrid. Currently, I use ListGridRecords to set the data displayed in the ListGrid. However, when I set the fields to be displayed in the table, the same fields are displayed when a row is expanded. In other words, the rest of the ListGrid record that is not set in the table is never displayed.

Again, note that I'm using Records, not DataSource objects. I've looked at this example:
http://www.smartclient.com/smartgwt/showcase/#grid_expanding_details
but it's slightly different for my case. Here's some example code:

Code:

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.types.ExpansionMode;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.ListGridRecord;

public class Grid implements EntryPoint {

        public void onModuleLoad() {
                ListGrid grid = new ListGrid();
               
                grid.setWidth(500);
                grid.setHeight(500);
                grid.setCanExpandRecords(true);
                grid.setExpansionMode(ExpansionMode.DETAILS);

                List<ListGridRecord> records = new ArrayList<ListGridRecord>();
               
                ListGridRecord record1 = new ListGridRecord();
                record1.setAttribute("A", "1");
                record1.setAttribute("B", "2");
                record1.setAttribute("C", "3");
                records.add(record1);
               
                ListGridRecord record2 = new ListGridRecord();
                record2.setAttribute("A", "4");
                record2.setAttribute("B", "5");
                record2.setAttribute("C", "6");
                records.add(record2);
               
                ListGridRecord[] listGridRecords = records.toArray(new ListGridRecord[0]);
               
                grid.setData(listGridRecords);

                ListGridField field1 = new ListGridField("A", "Value 1");
                ListGridField field2 = new ListGridField("B", "Value 2");
               
                grid.setFields(field1, field2);
               
                grid.draw();
        }
}

I'm using SmartGWT 3.0, GWT 2.5.1 in both Chrome and Firefox.

Any help would be appreciated.

Viewing all articles
Browse latest Browse all 4756

Trending Articles