1 | /* |
---|
2 | * Ext JS Library 2.2.1 |
---|
3 | * Copyright(c) 2006-2009, Ext JS, LLC. |
---|
4 | * licensing@extjs.com |
---|
5 | * |
---|
6 | * http://extjs.com/license |
---|
7 | */ |
---|
8 | |
---|
9 | Ext.onReady(function(){ |
---|
10 | |
---|
11 | Ext.QuickTips.init(); |
---|
12 | Ext.form.Field.prototype.msgTarget = 'side'; |
---|
13 | |
---|
14 | /* |
---|
15 | * Ext.ux.Multiselect Example Code |
---|
16 | */ |
---|
17 | var msForm = new Ext.form.FormPanel({ |
---|
18 | title: 'MultiSelect Test', |
---|
19 | width:700, |
---|
20 | bodyStyle: 'padding:10px;', |
---|
21 | renderTo: 'multiselect', |
---|
22 | items:[{ |
---|
23 | xtype:"multiselect", |
---|
24 | fieldLabel:"Multiselect<br />(Required)", |
---|
25 | name:"multiselect", |
---|
26 | dataFields:["code", "desc"], |
---|
27 | valueField:"code", |
---|
28 | displayField:"desc", |
---|
29 | width:250, |
---|
30 | height:200, |
---|
31 | allowBlank:false, |
---|
32 | data:[[123,"One Hundred Twenty Three"], |
---|
33 | ["1", "One"], ["2", "Two"], ["3", "Three"], ["4", "Four"], ["5", "Five"], |
---|
34 | ["6", "Six"], ["7", "Seven"], ["8", "Eight"], ["9", "Nine"]], |
---|
35 | tbar:[{ |
---|
36 | text:"clear", |
---|
37 | handler:function(){ |
---|
38 | msForm.getForm().findField("multiselect").reset(); |
---|
39 | } |
---|
40 | }] |
---|
41 | }], |
---|
42 | tbar:[{ |
---|
43 | text: 'Options', |
---|
44 | menu: [{ |
---|
45 | text:"Set Value (2,3)", |
---|
46 | handler: function(){ |
---|
47 | msForm.getForm().findField("multiselect").setValue("2,3"); |
---|
48 | } |
---|
49 | },{ |
---|
50 | text:"Toggle Enabled", |
---|
51 | handler: function(){ |
---|
52 | var m=msForm.getForm().findField("multiselect"); |
---|
53 | if (!m.disabled)m.disable(); |
---|
54 | else m.enable(); |
---|
55 | } |
---|
56 | }] |
---|
57 | }], |
---|
58 | |
---|
59 | buttons: [{ |
---|
60 | text: 'Save', |
---|
61 | handler: function(){ |
---|
62 | if(msForm.getForm().isValid()){ |
---|
63 | Ext.Msg.alert('Submitted Values', 'The following will be sent to the server: <br />'+ |
---|
64 | msForm.getForm().getValues(true)); |
---|
65 | } |
---|
66 | } |
---|
67 | }] |
---|
68 | }); |
---|
69 | |
---|
70 | |
---|
71 | /* |
---|
72 | * Ext.ux.ItemSelector Example Code |
---|
73 | */ |
---|
74 | var isForm = new Ext.form.FormPanel({ |
---|
75 | title: 'ItemSelector Test', |
---|
76 | width:700, |
---|
77 | bodyStyle: 'padding:10px;', |
---|
78 | renderTo: 'itemselector', |
---|
79 | items:[{ |
---|
80 | xtype:"itemselector", |
---|
81 | name:"itemselector", |
---|
82 | fieldLabel:"ItemSelector", |
---|
83 | dataFields:["code", "desc"], |
---|
84 | toData:[["10", "Ten"]], |
---|
85 | msWidth:250, |
---|
86 | msHeight:200, |
---|
87 | valueField:"code", |
---|
88 | displayField:"desc", |
---|
89 | imagePath:"images/", |
---|
90 | toLegend:"Selected", |
---|
91 | fromLegend:"Available", |
---|
92 | fromData:[[123,"One Hundred Twenty Three"], |
---|
93 | ["1", "One"], ["2", "Two"], ["3", "Three"], ["4", "Four"], ["5", "Five"], |
---|
94 | ["6", "Six"], ["7", "Seven"], ["8", "Eight"], ["9", "Nine"]], |
---|
95 | toTBar:[{ |
---|
96 | text:"Clear", |
---|
97 | handler:function(){ |
---|
98 | var i=isForm.getForm().findField("itemselector"); |
---|
99 | i.reset.call(i); |
---|
100 | } |
---|
101 | }] |
---|
102 | }], |
---|
103 | |
---|
104 | buttons: [{ |
---|
105 | text: 'Save', |
---|
106 | handler: function(){ |
---|
107 | if(isForm.getForm().isValid()){ |
---|
108 | Ext.Msg.alert('Submitted Values', 'The following will be sent to the server: <br />'+ |
---|
109 | isForm.getForm().getValues(true)); |
---|
110 | } |
---|
111 | } |
---|
112 | }] |
---|
113 | }); |
---|
114 | |
---|
115 | }); |
---|