在smartgwt中填充ListGridFields

时间:2010-10-20 12:54:46

标签: smartgwt

这是我的代码段:

    final ListGrid subscriberGrid = new ListGrid();
    subscriberGrid.setWidth(500);
    subscriberGrid.setHeight(224);
    subscriberGrid.setShowAllRecords(true);
    subscriberGrid.setSelectionType(SelectionStyle.SIMPLE);
    subscriberGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);

    ListGridField fnField = new ListGridField("fn", "First Name");
    ListGridField lnField = new ListGridField("ln", "Last Name");
    ListGridField emailField = new ListGridField("email", "E-mail");
    subscriberGrid.setFields(fnField, lnField, emailField);

如何为其输入值?我尝试启动ListGridRecord [],但我无法正确填写任何值。我也尝试过使用Javascript对象,但这也给了我一个错误。谷歌搜索也没有取得令人满意的结果。

TIA。

1 个答案:

答案 0 :(得分:2)

啊,Dah Darn。在得到答案之后我得到了答案。

        ListGridRecord temp = new ListGridRecord();

        temp.setAttribute("fn", "foo");
        temp.setAttribute("ln", "bar");
        temp.setAttribute("email", "baz");

        ListGridRecord[] record = { temp };

        subscriberGrid.setData(record);

抱歉凌乱^ - ^