Skip to content

Commit 0e2d909

Browse files
Allen CatadmanAllen Catadman
Allen Catadman
authored and
Allen Catadman
committed
field data pass to xtemplate data
1 parent 3eca788 commit 0e2d909

File tree

3 files changed

+104
-21
lines changed

3 files changed

+104
-21
lines changed

_me/form2.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},{
3939
xtype : "container"
4040
,layout : "column"
41-
,anchor : '100%'
41+
// ,anchor : '100%'
4242
,items : [{
4343
xtype : "container"
4444
,layout : "form"
@@ -47,7 +47,7 @@
4747
xtype : "textfield"
4848
,fieldLabel : "State"
4949
,name : "state"
50-
,anchor : '-20'
50+
// ,anchor : '-20'
5151
}]
5252
},{
5353
xtype : "container"

_me/layout.js

+101-18
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,7 @@ Ext.onReady(function(){
8585
console.log(selModel);
8686
console.log(record)
8787
if (record.get('leaf')){
88-
// clearExtjsComponent(contentPanel)
89-
/*contentPanel.update('');
90-
91-
// add the new component
92-
contentPanel.add(newPanel);
93-
94-
// redraw the containing panel
95-
contentPanel.doLayout();*/
96-
// var firstItem = Ext.getCmp('content-panel').items.first();
97-
// Ext.getCmp('start-panel').html = 'Hello World';
98-
// console.log(Ext.getCmp('start-panel'));
99-
// clearExtjsComponent(Ext.getCmp('start-panel'));
100-
// Ext.getCmp('content-panel').removeAll(true);
101-
102-
// Ext.apply(config, attributes);
103-
var node = { params: { clientId: 'clientId' , clientName: 'clientName', layoutName: "ClientLayout" }};
88+
var node = { params: { clientId: 'clientId' , clientName: 'clientName', layoutName: "ClientLayout" }};
10489

10590
// Ext.apply( config, attri );
10691
// var p = Ext.ComponentMgr.create(config, 'panel');
@@ -156,13 +141,111 @@ Ext.onReady(function(){
156141
,layout: "fit"
157142
,showScreenHeader:false
158143
})
159-
144+
var xtplWin = Ext.create("Ext.Window",{
145+
title : 'Template',
146+
id: 'xtplWin',
147+
width : 320,
148+
height: 180,
149+
// closable : false,
150+
// html : 'A window that is a modal!',
151+
modal : true
152+
,tpl: new Ext.XTemplate("<tpl><table><tr><td>Test :</td><td>&nbsp;{test}</td></tr><tr><td>Field :</td><td>&nbsp;{field}</td></tr></table></tpl>")
153+
,data: Ext.create('Ext.data.ArrayStore', {
154+
test: 'Don Griffin',
155+
field: 'Senior Technomage'
156+
})
157+
//,tplWriteMode: 'overwrite'
158+
//,renderTo: Ext.getBody()
159+
/*,items:[{
160+
xtype : 'panel'
161+
,title: 'test'
162+
,layout: 'card'
163+
,tpl : new Ext.XTemplate("<tpl><div> asdf </div></tpl>")
164+
,data : ""
165+
}]*/
166+
,buttons: [{
167+
text: 'Submit'
168+
,listeners: {
169+
click : {
170+
fn : function(){
171+
// btnHiFlag = true;
172+
console.log(Ext.getCmp('submitHide').fireEvent("click"));
173+
}
174+
}
175+
}
176+
},{
177+
text: 'Cancel'
178+
,listeners: {
179+
click : {
180+
fn : function(){
181+
Ext.getCmp('xtplWin').hide();
182+
}
183+
}
184+
}
185+
}]
186+
});
187+
var btnHiFlag = false;
160188
var sayHi = function(name){
161189
// Note this use of "this.text" here. This function expects to
162190
// execute within a scope that contains a text property. In this
163191
// example, the "this" variable is pointing to the btn object that
164192
// was passed in createDelegate below.
165-
alert('Hi, ' + name + '. You clicked the "' + this.text + '" button.');
193+
// alert('Hi, ' + name + '. You clicked the "' + this.text + '" button.');
194+
Ext.create("Ext.Window",{
195+
title : 'Extra window!',
196+
width : 350,
197+
height: 200,
198+
// closable : false,
199+
// html : 'A window that is a modal!',
200+
modal : true
201+
,items : [{
202+
xtype : "fieldset"
203+
,layout : "form"
204+
,border : false
205+
,items : [{
206+
xtype : "textfield"
207+
,fieldLabel : "Test"
208+
,name : "test"
209+
,id : "test"
210+
},{
211+
xtype : "textfield"
212+
,fieldLabel : "Field"
213+
,name : "field"
214+
,id : "field"
215+
}]
216+
}],
217+
buttons: [{
218+
text: 'Submit'
219+
,id: 'submitHi'
220+
,listeners: {
221+
click : {
222+
fn : function(){
223+
console.log(Ext.getCmp("test").getValue())
224+
var data = Ext.create('Ext.data.ArrayStore', {
225+
test: Ext.getCmp("test").getValue(),
226+
field: Ext.getCmp("field").getValue()
227+
})
228+
xtplWin.update(data);
229+
xtplWin.show();
230+
}
231+
}
232+
}
233+
},{
234+
text: 'Submit Hide'
235+
,id: "submitHide"
236+
,hidden: true
237+
,listeners:{
238+
click:{
239+
fn : function(){
240+
alert('submit gkan sa hide button');
241+
}
242+
}
243+
}
244+
},{
245+
text: 'Cancel'
246+
}]
247+
248+
}).show();
166249
}
167250

168251
var btn = new Ext.Button({

_me/me.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<!-- page specific -->
1818
<!-- <script type="text/javascript" src="me.js"></script> -->
1919
<script type="text/javascript" src="layout.js"></script>
20-
20+
<script type="text/javascript" src="main-panel.js"></script>
2121
</head>
2222

2323

0 commit comments

Comments
 (0)