/**=========================================== * @projectDescription Branch.js * @use by Branch.jsp * @author yangyang_wang * @create at 2008-08-27 星期三 上午 09:47:41 * @update by ==============================================*/ var grid=""; var dataModel=""; var ds=""; var aa=""; Ext.onReady(function(){ //ext准备方法开始 Ext.QuickTips.init(); //定义读取数据的模版 dataModel = Ext.data.Record.create([ { name:'unInnerCode',mapping:'unInnerCode'}, { name:'orderCode',mapping:'orderCode'}, { name:'unName',mapping:'unName'} ]); //定义列模板 var colModel = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), { id:'unInnerCode', header:"unInnerCode", dataIndex:'unInnerCode', hidden:true, width:130, sortable: true, align:'left' }, { id:'unName', header:"单位名称", dataIndex:'unName', hidden:false, width:130, fixed:true, sortable: true, align:'left' } ]); //定义存储器,从后台读取json数据 ds = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({url: projectPath+'/branch.do?method=listBranch'}), reader: new Ext.data.JsonReader({root: 'datalist'},dataModel) }); //定义列表对象 grid = new Ext.grid.EditorGridPanel({ ds: ds, autoExpandColumn: 'unName', clicksToEdit:1, selModel: new Ext.grid.RowSelectionModel(), cm: colModel, frame:false, border:false, listeners:{ //单击 rowclick : function(grid,row){ rowClickFun(); } } }); grid.render('grid_area'); ds.load(); //ext准备方法结束 } ); /****************************************** 自定义函数 ********************************************************************************/ var winHandle; var unInnerCode; function fireResize(setHeight,setWidth){ grid.setSize(setHeight,setWidth); gridr.setSize(setHeight,setWidth+10); } function rowClickFun(){ //如果点击确定 var m = grid.getSelectionModel().getSelections(); unInnerCode=m[0].data['unInnerCode']; dsr.reload({params:{unInnerCode:unInnerCode}}); }