BranchQueryPage.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**===========================================
  2. * @projectDescription Branch.js
  3. * @use by Branch.jsp
  4. * @author yangyang_wang
  5. * @create at 2008-08-27 星期三 上午 09:47:41
  6. * @update by
  7. ==============================================*/
  8. var grid="";
  9. var dataModel="";
  10. var ds="";
  11. var aa="";
  12. Ext.onReady(function(){
  13. //ext准备方法开始
  14. Ext.QuickTips.init();
  15. //定义读取数据的模版
  16. dataModel = Ext.data.Record.create([
  17. { name:'unInnerCode',mapping:'unInnerCode'},
  18. { name:'orderCode',mapping:'orderCode'},
  19. { name:'unName',mapping:'unName'}
  20. ]);
  21. //定义列模板
  22. var colModel = new Ext.grid.ColumnModel([
  23. new Ext.grid.RowNumberer(),
  24. {
  25. id:'unInnerCode',
  26. header:"unInnerCode",
  27. dataIndex:'unInnerCode',
  28. hidden:true,
  29. width:130,
  30. sortable: true,
  31. align:'left'
  32. },
  33. {
  34. id:'unName',
  35. header:"单位名称",
  36. dataIndex:'unName',
  37. hidden:false,
  38. width:130,
  39. fixed:true,
  40. sortable: true,
  41. align:'left'
  42. }
  43. ]);
  44. //定义存储器,从后台读取json数据
  45. ds = new Ext.data.Store({
  46. proxy: new Ext.data.HttpProxy({url: projectPath+'/branch.do?method=listBranch'}),
  47. reader: new Ext.data.JsonReader({root: 'datalist'},dataModel)
  48. });
  49. //定义列表对象
  50. grid = new Ext.grid.EditorGridPanel({
  51. ds: ds,
  52. autoExpandColumn: 'unName',
  53. clicksToEdit:1,
  54. selModel: new Ext.grid.RowSelectionModel(),
  55. cm: colModel,
  56. frame:false,
  57. border:false,
  58. listeners:{
  59. //单击
  60. rowclick : function(grid,row){
  61. rowClickFun();
  62. }
  63. }
  64. });
  65. grid.render('grid_area');
  66. ds.load();
  67. //ext准备方法结束
  68. }
  69. );
  70. /****************************************** 自定义函数 ********************************************************************************/
  71. var winHandle;
  72. var unInnerCode;
  73. function fireResize(setHeight,setWidth){
  74. grid.setSize(setHeight,setWidth);
  75. gridr.setSize(setHeight,setWidth+10);
  76. }
  77. function rowClickFun(){
  78. //如果点击确定
  79. var m = grid.getSelectionModel().getSelections();
  80. unInnerCode=m[0].data['unInnerCode'];
  81. dsr.reload({params:{unInnerCode:unInnerCode}});
  82. }