/source/gl/mb/form/combo1value.html

http://prosporous.googlecode.com/ · HTML · 191 lines · 184 code · 7 blank · 0 comment · 0 complexity · 22c780632371eee718154c29f3422a45 MD5 · raw file

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <title>??????-combo</title>
  6. <{$showjs}>
  7. <link rel="stylesheet" type="text/css" href="/css/main.css" />
  8. <script language="javascript">
  9. Ext.onReady(function(){
  10. var myMask = new Ext.LoadMask(Ext.getBody(), {
  11. msg: '???...',
  12. removeMask: true //?????
  13. });
  14. var store = new Ext.data.SimpleStore({
  15. fields:['name','value'],
  16. data:[<{$items}>]
  17. });
  18. var combobox = new Ext.form.ComboBox({
  19. id : 'combobox',
  20. name : 'combo',
  21. height: 150,
  22. width:200,
  23. fieldLabel : '????',
  24. hiddenName : 'combo',
  25. //data:store.data,
  26. value:'<{$ck}>',
  27. store:store,
  28. mode:'local',
  29. displayField:'name',
  30. valueField :'value',
  31. triggerAction:"all",
  32. listeners: {
  33. "select":{
  34. fn: function(_combo,store,index){
  35. _combo["selectItem"]=store;
  36. var label_ = store.data.name;
  37. var value_ = store.data.value;
  38. Ext.getCmp('label').setValue(label_);
  39. Ext.getCmp('value').setValue(value_);
  40. },
  41. scope: this
  42. }
  43. }
  44. });
  45. var form = new Ext.TabPanel({
  46. activeTab: 0,
  47. // height:parent.Ext.get('t<{$fld.id}>').getHeight()-36,
  48. height:parent.Ext.get('t<{$fld.id}>').getHeight()-36,
  49. region : 'center',
  50. title : false,
  51. border : false,
  52. frame : true,
  53. defaults:{bodyStyle:'padding:10px'},
  54. items : [{
  55. title:'????',
  56. layout:'column',
  57. bbar:['->','-',{
  58. text: '??',
  59. handler:function(){
  60. myMask.show();
  61. var DATA=Ext.data.Record.create([{
  62. name:"name",value:"value"}
  63. ]);
  64. var label_ = Ext.getCmp('label').getValue();
  65. var value_ = Ext.getCmp('value').getValue();
  66. store.insert(0,new DATA({name:label_,value:value_}));
  67. combobox.setValue(label_);
  68. store["selectItem"]=store.getAt(0);
  69. myMask.hide();
  70. }
  71. }//,'-',{
  72. // text: '??',
  73. // handler:function(){
  74. // myMask.show();
  75. // var label_ = Ext.getCmp('label').getValue();
  76. // var value_ = Ext.getCmp('value').getValue();
  77. // if(combobox["selectItem"]!=null){
  78. // combobox["selectItem"].set("value",value_);
  79. // combobox.setValue(label_);
  80. // }else{
  81. // Ext.Msg.alert('??','???????');
  82. // }
  83. // myMask.hide();
  84. // }
  85. // }
  86. ,'-',{
  87. text: '??',
  88. handler:function(){
  89. if(combobox["selectItem"]!=null)
  90. Ext.MessageBox.confirm("????","???????????",function(_btn){
  91. if(_btn=="yes"){
  92. try{store.remove(combobox["selectItem"]);}catch(_err){}
  93. if(store.getCount()){
  94. combobox.setValue(store.getAt(0).get("value"));
  95. combobox["selectItem"]=store.getAt(0);
  96. }else{
  97. combobox.setValue('');
  98. combobox["selectItem"]=null;
  99. }
  100. }
  101. });
  102. }
  103. },'-'],
  104. items:[{
  105. border:false,
  106. columnWidth:.5,
  107. autoHeight: true,
  108. layout:'column',
  109. bodyStyle:'padding:10px',
  110. items:[
  111. {
  112. xtype: 'label',
  113. text: '??',
  114. cls:'x-form-check-group-label',
  115. anchor:'-15'
  116. },{
  117. xtype: 'textfield',
  118. id:'label',
  119. name: 'label',value:'<{$xv}>'
  120. }]
  121. },{
  122. border:false,
  123. columnWidth:.5,
  124. autoHeight: true,
  125. bodyStyle:'padding:10px',
  126. layout:'column',
  127. items:[{
  128. xtype: 'label',
  129. text: '?',
  130. cls:'x-form-check-group-label',
  131. anchor:'-15'
  132. },{
  133. xtype: 'textfield',
  134. id:'value',
  135. name: 'value',value:'<{$ck}>' }]
  136. },{
  137. xtype:'fieldset',
  138. title:'??',
  139. columnWidth:1,
  140. autoHeight: true,
  141. bodyStyle:'padding:10px',
  142. layout:'form',
  143. items:[combobox]
  144. }]
  145. }],
  146. buttons: [{
  147. text: '??',
  148. handler:function(){
  149. var x = '';
  150. Ext.each(combobox.store.data.items,function(a,b,c){
  151. x = x + a.data.name+'#_#'+a.data.value+ '#=#';
  152. });
  153. myMask.show();
  154. Ext.Ajax.request({
  155. waitMsg:'????....',
  156. method:'POST',
  157. params:{op:'save',type:'combovalue',param:x,id:'<{$fld.id}>',ck:Ext.getCmp('combobox').getValue()},
  158. url:'fldcfg.php',
  159. success:function(form, action) {
  160. myMask.hide();
  161. parent.Ext.getCmp('t<{$fld.id}>').close();
  162. },
  163. failure: function(form, action) {
  164. }
  165. });
  166. }
  167. },{
  168. text: '??'
  169. }]
  170. });
  171. var tabpanel = new Ext.form.FormPanel({
  172. renderTo: Ext.getBody(),
  173. //frame:true,
  174. //defaults:{autoScroll: true},
  175. items:[
  176. form
  177. ]
  178. });
  179. });
  180. </script>
  181. </head>
  182. <body>
  183. </body>
  184. </html>