こんにちは、私はSmartGWT
を使用しようとしています。SmartGWTのListGridのsetData
は私がdocumentsArrayList
とテーブルにあるArrayListの
ArrayList<FileDocument> documentsArrayList = new ArrayList<FileDocument>();
//すべての値を持つグリッドの
private ListGrid getDocumentTable() {
if (documentTable == null) {
documentTable = new ListGrid();
documentTable.setSize("644px", "379px");
documentTable.setCanResizeFields(true);
documentTable.setFields(getStatus(),getIcon(),getName(),getSize(),getModifiedby(),getModifiedDate());
}
return documentTable;
}
のフィールドがあるよう
public ListGridField getName() {
if (name == null) {
name = new ListGridField("name","Name");
}
return name;
}
私は入れたいリスト値をテーブルに配列する値。
documentTable.setData(一部のリストグリッドレコード)。
ArrayList
をListGridRecord
に変換する方法を教えてください。
listGrid.setData(getListridRecords(employees)); // set records here
private void getListGridRecords(ArrayList employees) {
ListGridRecords records[]=null;
if(employees!=null){
records = new ListGridRecord[employees.size()];
for(int cntr=;cntr<employees.size();cntr++){
ListGridRecord record = new ListGridRecord();
Employee emp = employees.get(cntr);
record.setAttribute("name",emp.getName()); //your ListGridField 's name
record.setAttribute("status",emp.getStatus()); //your ListGridField 's name
//.. more goes here
records[cntr] = record;
}
}
return records;
}
別の方法でした:
oops私の間違い。私はそれを編集しました:) –
あなたはこの質問で私を助けることができます[リンク](http://stackoverflow.com/q/10412060/780393) – GameBuilder
何が問題なのですか? –