关于Ext如果动态生成 form 下拉框的,并且可以动态改变内容可以改变刷新的方法:
需要效果如下图:
直接上代码:
<?xml version="1.0" encoding="UTF-8"?>
<Application title="报表查询(汇总分类)" version="ext4" xmlns="http://www.w3school.com.cn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3school.com.cn /schema/Application.xsd"
script="/appreport/report/js/reportList.js">
<TabPanel ID="tabpanel" ref="tabpanel">
<Panel ID="panel_1" title="报表查询(汇总分类)" layout="border" ref="panel_1" >
<Form ID="classify" region="north" layout="form" height="85" ref="classify" autoScroll="false">
<FieldSet title="选择类别" colspan="2" columnLength="2" height="80" columnWidths="[0.5,0.5]">
<column title="报表分类" allowBlank="true" editable="false" type="combo" url='/ireport/report/selectRqreportClassification'
valueField="classification" displayField="classification" root="classifys" name="classification" width="120" loadstore="true"
onChange="classification_change_handle"/>
</FieldSet>
</Form>
<Grid title="报表信息" ID="reportlist" region="center" flex="1" baseParams="{'cond.auditflag':'0'}"
url='/ireport/report/selectReportList' root="rqreportInfos"
loadstore="true" splitPage="true" pkname="rid" ref="reportlist" >
<column type="checkBox"/>
<column title="报表ID" name="rid" />
<column title="名称" name="reportname" width="200" renderer="to_query"/>
<column title="报表文件" name="reportfile" width="160" />
<column title="报表分类" name="classification"/>
<column title="备注" name="remark" />
<column title="单位名称" name="corpdesc" width="160" />
<column title="制单人编码" name="recordercode" />
<column title="制单人名称" name="recorderdesc" />
<column title="制单时间" name="recordtime" type="datefield"/>
</Grid>
</Panel>
</TabPanel>
</Application>
function classification_change_handle() {
var classify = Ext.getCmp('classify')
var newValue = classify.getField('classification').getValue();
var theGrid = Ext.getCmp('reportlist');
var extraParams = theGrid.getStore().getProxy().extraParams;
var vparams="";
if("所有分类"==newValue){
vparams = {'cond':{'auditflag':'0'}};
}else {
vparams = {'cond':{'auditflag':'0','classification':newValue}};
}
extraParams['jsonString'] = Ext.JSON.encode(vparams);
theGrid.loadList();
}
其中url那部分返回值信息如下