一、如何禁用或者启用某个菜单

有的时候,我们在做OA时,有时会根据需要,启用或者禁用某个菜单项,在ExtJS中,可以通过如下的操作进行。

 

 

 1 Ext.onReady(function() {
 2     Ext.BLANK_IMAGE_URL = 'resources/images/default/s.gif';
 3     Ext.QuickTips.init();
 4     var tb = new Ext.Toolbar({
 5         applyTo: 'tb',
 6         width: 400
 7     });
 8     var styleMenu = new Ext.menu.Menu({
 9         items: [{
10             text: '主题选择',
11             id: 'style',
12             menu: new Ext.menu.Menu({
13                 items: [{
14                     text: '红色主题',
15                     checked: true,
16                     group: 'theme'
17                 }, {
18                     text: '蓝色主题',
19                     checked: false,
20                     group: 'theme'
21                 }, {
22                     text: '黑色主题',
23                     checked: false,
24                     group: 'theme'
25                 }]
26             })
27          }, {
28                 text: '启用主题',
29                 checked: true,
30                 checkHandler: function() { Ext.getCmp('style').setDisabled(!this.checked) }
31          }]
32     });
33     tb.add({ text: '主题', menu: styleMenu });
34 });

 

二、如何设置DateField的默认值。

设置DateField的默认值,可以直接给value属性赋值,如:value:  '01/01/2009',如果要设置默认值为当天的日期,可以如下设置:value: new Date

1             new Ext.form.DateField({
2                 id: 'df',
3                 fieldLabel: '日期',
4                 format: 'Y年m月d日',
5                 width: 150,
6                 //value: '01/01/2009'
7                 value: new Date
8             })
9 

相关文章:

  • 2021-06-21
  • 2021-10-08
  • 2022-02-14
  • 2021-07-03
  • 2021-12-19
  • 2021-07-29
  • 2021-09-16
猜你喜欢
  • 2021-11-11
  • 2022-12-23
  • 2021-06-24
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2019-01-20
相关资源
相似解决方案