日期:2014-05-16  浏览次数:20431 次

从数据库中加载数据,实现两个comboBox与gridpanel的联动(comboBox默认加载第一项值)

/**不知道怎么插入图片,代码保证正确。下拉列表名分别是:贷方凭证类型 ,本方科目

*图片放在下面的附件里了

?* 细节的东西,自己慢慢看,肯定写的有点粗糙。

*/


??Ext.namespace('speedy.cm.tcmVoucherOppSet');
??speedy.cm.tcmVoucherOppSet.MainPanel = function(config) {
???Ext.applyIf(this, config);
???this.initUIComponents();

???speedy.cm.tcmVoucherOppSet.MainPanel.superclass.constructor.call(this);
??};
?Ext.extend(speedy.cm.tcmVoucherOppSet.MainPanel, Ext.Panel, {
???????????? firstValue :'',
?tcmvoucheroppsettingId :'',??? //tcm_voucheroppsetting表的主键vId
??? tcmVoucherSettingId :'',?? //tcm_VoucherSetting表的主键vId
?initUIComponents : function() {
??
??this.st3= new Ext.data.Store({
???baseParams : {limit:50},
???reader : new Ext.data.JsonReader({
?????totalProperty:'totalCount',
?????id : "id",
?????root : "result"},
?????[
????{name : 'vId',????????? mapping : 'vId'},
????{name : 'vVouId',?????? mapping : 'vVouId'},
????{name : 'vOppAccCode',? mapping : 'vOppAccCode'},?
????{name : 'vOppAccName',? mapping : 'vOppAccName'},?
????{name : 'nIssum',?????? mapping : 'nIssum'},?
????{name : 'nIsusing',???? mapping : 'nIsusing'},??
????{name : 'vAbstract',??? mapping : 'vAbstract'},?
????{name : 'vCustomer',??? mapping : 'vCustomer'},?
????{name : 'vFlowCode',??? mapping : 'vFlowCode'}
????
????]),
???proxy : this.proxy||new Ext.data.HttpProxy({
????
????url:'ui/modules/speedy/cm/VoucherOppSet/getAllTcmVoucherOppSetByVouId.action'

????})
???
??});
??
??this.accStore= new Ext.data.Store({
???baseParams : {limit:50},
???reader : new Ext.data.JsonReader({
?????totalProperty:'totalCount',
?????id : "id",
?????root : "result"},
?????[
????{name : 'vId',?????????? mapping : 'vId'},
????{name : 'vOppId',??????? mapping : 'vOppId'},
????{name : 'vBankAccount',? mapping : 'vBankAccount'},?
????{name : 'vCostCenter',?? mapping : 'vCostCenter'},?
????{name : 'vRemark',?????? mapping : 'vRemark'}
????
????]),
???proxy : this.proxy||new Ext.data.HttpProxy({
????
????url:'ui/modules/speedy/cm/VoucherOppSet/getAllTcmVoucherOppAccountByOppId.action'

????})
???
??});
??
??//加载accStore数据源
?? this.accStore.load();
??
??
??this.oppGridPanel = new Ext.grid.GridPanel({
???
???bbar :? new Ext.PagingToolbar({
??????xtype ??: 'paging',
??????pageSize?: 50,
??????store??: this.st3,
??????displayInfo?: true,
??????????? displayMsg?: '显示记录从 {0} 到 {1} 总共 {2}',
??????????? emptyMsg?: '没有记录'
?????}),
???height :100,
???store : this.st3,
???border : false,
???loadMask: {msg:'正在取数,请稍等!'},
???listeners : {
?????? click : {
????fn : function() {
??????? var record=this.oppGridPanel.selModel.getSelected();
?????if( record!= null)
?????{
??????this.accStore.baseParams.vOppId=record.get('vId');
??????
??????this.accStore.load();
?????}
????}.createDelegate(this)
???}
???},
???columns : [
???new Ext.grid.RowNumberer(),
???{
????width ??: ?150,
????header ??: ?'唯一ID',
????dataIndex ?: ?'vId',
????sortable ?: ?true,
????hidden??:?true
???},
???{
????width ??: ?150,
????header ??: ?'对应本方信息表中唯一ID ',
????dataIndex ?: ?'vVouId',
????sortable ?: ?true,
????hidden??:?true
???},
???{
????width ??: ?150,
????align??:?'Left',
????header ??: ?'对方科目编号',
????dataIndex ?: ?'vOppAccCode',
????sortable ?: ?true,
????hidden??:?false
???}
???,
???{
????width ??: ?250,
????align??:?'Left',
????header ??: ?'对方科目名称',
????dataIndex ?: ?'vOppAccName',
????sortable