实现eXtremeComponents的AutoGenerateColumns时遇到的问题!

我的系统中有这样两个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
}

如果我要在extrmeTable中访问Finance对象中一个Attribute的字段,可以这样写:

<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);
			}
		}
	}
}

却发现不行,返回不了字段的值,有人遇到过这样的情况吗?

你可能感兴趣的:(实现eXtremeComponents的AutoGenerateColumns时遇到的问题!)