1. How to disable or enable a menu
Sometimes, when we do OA, we sometimes enable or disable a menu item as needed. In extjs, we can perform the following operations.
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: 'topic select ',
11 ID: 'style ',
12 menu: New Ext. Menu. menu ({
13 items :[{
14 text: 'Red theme ',
15 checked: True,
16 group: 'Theme'
17 },{
18 Text: 'Blue theme ',
19 checked: false,
20 group: 'Theme'
21 },{
22 text: 'black theme ',
23 checked: false,
24 group: 'Theme'
25}]
26 })
27 },{
28 text: 'Enable theme ',
29 Checked: True,
30 checkhandler: function () {Ext. getcmp ('style'). setdisabled (! This. Checked )}
31}]
32 });
33 TB. Add ({text: 'topic ', menu: stylemenu });
34 });
2. How to set the default value of datefield.
To set the default value of datefield, you can directly assign values to the value attribute, for example, value: '2014/1/123'. To set the default value to the date of the current day, you can set it as follows: Value: New Date
1 New Ext. Form. datefield ({
2 ID: 'df ',
3 fieldlabel: 'date ',
4 format: 'Y-m-d ',
5 width: 150,
6 // value: '2017/123'
7 value: New Date
8 })
9