在C/S的开发中,用户在选择的时候一般会要求提供多列下拉列表,以便更好的参考所选择资料的正确性。但是EXT似乎不支持这个功能。但是可不可以通过其 它方式达到这一效果呢?本人经过一天的尝试,终于达到的相关的效果,唯一美中不足的是,ComboBox在选择后,value和text好象有问题,只能 显示value.好了,不说了,看代码:
- var createStockDropDown=function(id){
- var stockname="" ;
- var itemno="" ;
- var spec="" ;
- var innerId="" ;
- var tpl='<tpl for="."><div style="height:200px"><div id="' +id+ '"></div></div></tpl>'
- this .StockDropDown = new Ext.form.ComboBox({
- store:new Ext.data.SimpleStore({fields:[ 'value' , 'text' ],data:[[ '' , '' ]]}),
- editable:false ,
- mode: 'local' ,
- listWidth:450 ,
- triggerAction:'all' ,
- maxHeight: 300 ,
- valueField:'value' ,
- displayField:'text' ,
- tpl: tpl,
- selectedClass:'' ,
- onSelect:Ext.emptyFn
- });
- this .StockDropDown.getItemNo=function()
- {
- return itemno;
- };
- this .StockDropDown.getStockName=function()
- {
- return stockname;
- };
- this .StockDropDown.getSpec=function()
- {
- return spec;
- };
- var StockDropDowncm = new Ext.grid.ColumnModel([
- {header:'编号' ,dataIndex: 'id' },
- {header:'物料编号' ,dataIndex: 'itemno' },
- {header:'物料名称' ,dataIndex: 'stockname' },
- {header:'物料规格' ,dataIndex: 'spec' },
- {header:'单位' ,dataIndex: 'unit' }
- ]);
- var StockDropDownds = new Ext.data.Store({
- proxy: new Ext.data.HttpProxy({url: