按照一般思维,在UI中填充数据是在loadFields()之后的,当然,也在onLoad()之后
在ListUI中填充数据是有区别的,一般ListUI都是虚模式,所以填充数据就不是loadFields()后来,虚模式跟网页的真分页类似,滚动条向下拖就重新查询数据库将数据填充到界面上来。
例如,有个tblMain(ListUI中KDTable默认实例),有个列selected,是checkBox,有个列billStatus(单据状态),
现要求没审核的不允许操作,用用颜色标记出来
写个内部类:
- class TestFillListener implements KDTDataFillListener {
- public void afterDataFill(KDTDataRequestEvent e) {
- for (int i = e.getFirstRow(); i < e.getLastRow(); i++) {
- IRow row = tblMain.getRow(i);
- int billStatusValue = ((BizEnumValueDTO) row.getCell("billStatus").getValue()).getInt();
- if (billStatusValue == BillStatusEnum.AUDITED_VALUE) {
- row.getCell("selected").getStyleAttributes().setLocked(false);
- } else {
- row.getCell("selected").getStyleAttributes().setLocked(true);
- row.getCell("selected").getStyleAttributes().setBackground(Color.LIGHT_GRAY);
- }
- }
- }
- }
还要在ListUI中注册监听,一般注册监听在initListener()中
- tblMain.getDataRequestManager().addDataFillListener(fillListener);
fillListener是内部类的实例:
- private TestFillListener fillListener = new TestFillListener();
好了,所有的操作都在内部类的方法afterDataFill()中