eXtremeComponentsのAutoGenerateColumnsを実装するときに発生する問題!

2175 ワード

私のシステムにはこのような2つのJavaBeanがあります.
public class Finance extends BaseObject {

	private String uniqueId;
	private String id;
	private String name;
	private Map    attributes = new TreeMap();

         //get/set property
}
public class Attribute extends BaseObject {

	private String id;
	private String chLabel;
	private String enLabel;
	private String type;
	private String value;

         //get/set property
}

FinanceオブジェクトのAttributeフィールドにextrmeTableでアクセスする場合は、次のように書きます.
<ec:table items="dataList"
	var="datas"
	action="${ctxPath}/dataShow.html">

    <ec:row highlightRow="true">
          <ec:column property="id" width="5%"/>
          <ec:column property="attributes" width="5%">
              ${datas.attributes.attr1}
          </ec:column>
    </ec:row>
</ec:table>

次に、AutoGenerateColumnsを使用して列を動的に作成します.
public class AutoGenDataListColsImpl implements AutoGenerateColumns {
	public void addColumns(TableModel model) {
		List beans = (List)model.getContext().getRequestAttribute("dataList");
		String var = model.getTableHandler().getTable().getVar();

		if (beans!=null && beans.size()>0) {
			Finance finObj = (Finance)beans.get(0);
			Map attrs = finObj.getAttributes();
			Iterator colItr = attrs.keySet().iterator();
			while(colItr.hasNext()) {
				String key = (String)colItr.next();
				Attribute attr = (Attribute)attrs.get(key);
				Column column = new Column(model);
				column.setProperty("attributes");
				column.setValue("${"+var+".attributes.attr1}");
				column.setTitle(attr.getChLabel());
				model.getColumnHandler().addAutoGenerateColumn(column);
			}
		}
	}
}

しかし、だめだと気づき、フィールドの値が戻らないという状況に遭遇したことがありますか?