By Vitaliy on March 19, 2013. ext-4.1.1
There is a private property margin$ which we can change and update layout.
Js Code
{
text: 'Increment Margin',
handler: function () {
var root = this.up('#root'),
west = root.down('#west'),
center = root.down('#center'),
wm = west.margin$,
cm = center.margin$;
if (wm.top <= 10) wm.top++;
if (wm.right <= 10) wm.right++;
if (wm.bottom <= 10) wm.bottom++;
if (wm.left <= 10) wm.left++;
if (cm.top <= 10) cm.top++;
if (cm.right <= 10) cm.right++;
if (cm.bottom <= 10) cm.bottom++;
if (cm.left <= 10) cm.left++;
root.doLayout();
}
}
By Vitaliy on March 12, 2013. ext-4.1.1
We can use container event "add" to setup splitter width or height.
Js Code
listeners:{
add: function (c, i) {
if (i.xtype == 'bordersplitter') i.width = 2;
}
}
By Vitaliy on March 11, 2013. ext-4.1.1
One or more member functions can be specified in a configuration object passed into the XTemplate constructor for
more complex processing.
Js Code
tpl: ['<tpl for=".">',
'<ul class="details">',
'<li><b>Name:</b> {Name}</li>',
'<li><b>Email:</b> {Email}</li>',
'<tpl if="this.isDisabled(values)">',
'<li class="warning"><b>Warning:</b> user is disabled</li>',
'<tpl else>',
'<li class="comment"><b>Comment:</b> active user</li>',
'</tpl>',
'</ul>',
'</tpl>',
{
isDisabled: function (r) {
return r.Disabled === true;
}
}],
By Vitaliy on March 11, 2013. ext-4.1.1
The tpl tag and the for operator are used to process the provided data array.
The tpl tag and the if operator are used to provide conditional checks for deciding whether or not to render
specific parts of the template.
Js Code
tpl: ['<tpl for=".">',
'<ul class="details">',
'<li><b>Name:</b> {Name}</li>',
'<li><b>Email:</b> {Email}</li>',
'<tpl if="Comment">',
'<li><b>Comment:</b> {Comment}</li>',
'</tpl>',
'</ul>',
'</tpl>'],
By Vitaliy on March 11, 2013. ext-4.1.1
Use "tpl" config property to setup panel's body template.
This option used in conjunction with the "data" and "tplWriteMode" configurations.
Js Code
Ext.widget({
title: 'Simple Template',
xtype: 'panel',
width: 300,
bodyPadding: 10,
tpl: ['<ul class="details">',
'<li><b>Name:</b> {Name}</li>',
'<li><b>Email:</b> {Email}</li>',
'</ul>'],
data: {
Name: 'User-1',
Email: 'user-1@gmail.com'
},
tbar: [{
text: 'Update Content',
handler: function () {
var panel = this.up('panel'),
data = {
Name: 'New-User',
Email: 'new-user@gmail.com'
};
panel.update(data);
}
}],
renderTo: 'output'
});