Thursday, July 21, 2011

Format ComboBox ExtJS

items: [
{
xtype: 'combobox',
fieldLabel: 'State',
store: 'TestStore',
queryMode: 'local',
displayField: 'State',

listConfig: {
getInnerTpl: function () {

return '
{State}:{status}
';
}
}

}

Tab Inside a Tab ExtJS

Ext.create('Ext.TabPanel', {
renderTo: Ext.getBody(),
id: 'main-tabs',
height: 300,
width: 600,
activeTab: 0,
defaults: {
padding: 10
},
items: [{
xtype: 'tabpanel',
title: 'Tab 1',
id: 'tab1',
activeTab: 0,
padding: 5,
border: true,
plain: true,
defaults: {
padding: 10
},

items: [{
title: 'Sub-tab 1',
id: 'subtab1',
html: 'Sub-tab 1 content'
},{
title: 'Sub-tab 2',
id: 'subtab2',
html: 'Sub-tab 2 content'
},{
title: 'Sub-tab 3',
id: 'subtab3',
html: 'Sub-tab 3 content'
}]
},{
title: 'Tab 2',
id: 'tab2',
html: 'Tab 2 content'
},{
title: 'Tab 3',
id: 'tab3',
html: 'Tab 3 content'
},{
title: 'Tab 4',
id: 'tab4',
html: 'Tab 4 content'
},{
title: 'Tab 5',
id: 'tab5',
html: 'Tab 5 content'
}]

});
});

Adding panel to ViewPort (ExtJS)

Add Panels to ViewPort on the fly

1) Define ViewPort

viewport = Ext.create('Ext.container.Viewport', {
layout: {
type: 'border'
},
defaults: {
split: false
},
items: [{

region: 'center',
layout: 'border',
frame: false,
padding: '0 5 0 0',
border: false,
items: [{
region: 'center',
items: [
{
xtype: 'grid1'
}

]
}]
},


{

region: 'south',
frame: false,
padding: '0 5 0 0',
border: false
}
]
});


2) Add panel on the fly to defined region. In our example we are adding panel to "South" region

southRegion = viewport.getComponent(1);

southRegion .add(myPanel);

southRegion .setWidth(200);

southRegion .doLayout();



Tuesday, July 19, 2011

Remove Special character from String

string Formatted = Regex.Replace(, @"[\-]", "");

Regular Expression for YYYYMM

Well i managed to make this one for now. If you have better one please share .

YYYYMM

(^(19|20)\d{2})((0[1-9])|(1[0-2])$)

e.g.
PASS : 200901 , 201012 ...

FAILS :211001 , 200913 ...

Sunday, July 17, 2011

Timeout Ext.Ajax.request

Set :

Ext.Ajax.timeout = < millisecond >;

e.g.

Ext.Ajax.timeout = 90000;

Friday, July 08, 2011

Get Security Information from Client

In order to get the security information from client in a Service , use the following Class :

ServiceSecurityContext Class

ServiceSecurityContext.Current.WindowsIdentity.Name
ServiceSecurityContext.Current.PrimaryIdentity.Name

More Information:
http://msdn.microsoft.com/en-us/library/system.servicemodel.servicesecuritycontext.aspx