|
发表于 2021-4-1 15:16:27
|
显示全部楼层
1.action的java代码
- public static Table loadCData(String parentid){
- Table tableResObj = TableUtils.createTable("AP_CHJ", "/appdemo/test/data");
- for(int i =0;i<3;i++){
- Row row = tableResObj.appendRow();
- row.setState(ModifyState.NEW);
- row.setValue("AP_CHJ", UUID.randomUUID().toString());
- row.setValue("fZHJ", parentid);
- row.setValue("fName", "从"+i);
- row.setValue("fSZ", 12.3+i);
- row.setState(ModifyState.NEW);
- }
- tableResObj.getProperties().put(Table.PROP_NAME_ROWID, "AP_CHJ");
- return tableResObj;
- }
复制代码 2.直接点按钮调用的action,没有操作什么新增
- Model.prototype.button2Click = function(event){
- var mainData = this.comp("mainData");
- var detailData = this.comp("detailData");
- var detailGrid = this.comp("detailGrid");
- var parentid = mainData.getCurrentRowID();
- var param = new biz.Request.ActionParam();
- param.setString("parentid", parentid);
- biz.Request.sendBizRequest({
- "context" : this.getContext(),
- "parameters" : param,
- "action" : "loadCDataAction",
- "callback" : function(callbackData) {
- if (callbackData.state) {
- detailData.loadData(callbackData.response);
- detailGrid.refresh();
- } else
- alert("执行失败");
- }
- });
-
- };
复制代码 3.在主data的关系上设置的计算规则,计算从data的合计,loadData数据可以自动计算
- <col name="fJE" xid="ruleCol1">
- <calculate xid="calculate1">
- <expr xid="default2">$model.comp('detailData').sumByAll('fSZ', $row)</expr></calculate> </col>
复制代码
|
|