您的位置:首页 > 其它

制作可刷新的side bar rest wcf 数据源(sencha2.0项目)

2011-11-08 18:35 344 查看


Ext.application({
name: 'Sencha',

launch: function () {

var tpl = new Ext.XTemplate(
'<tpl class="contact2">{MetricName}</tpl></br><tpl class="contact2">{HostName}</tpl><tpl if="StatusId > 1"><img style="float:right;padding-right:50px" src="/image/notification_error_meitu_1.jpg"/></tpl><tpl if="StatusId < 2"><img style="float:right;padding-right:50px" src="/image/error.gif"/></tpl>'
);

Ext.regModel('Tweet', {
fields: [{
name: 'MetricId',
type: 'int'
}, {
name: 'HostName',
type: 'string'
}, {
name: 'MetricName',
type: 'string'
}, {
name: 'ParameterId',
type: 'int'
}, {
name: 'StatusId',
type: 'int'
}, {
name: 'UserDomain',
type: 'string'
}, {
name: 'ParentNodeId',
type: 'int'
}, {
name: 'NodeId',
type: 'int'
}, {
name: 'HasChildren',
type: 'int'
}]
});

var store = new Ext.data.Store({
model: 'Tweet',
proxy: {
url: 'http://localhost:8080/exampleJsonpService/Nodes',
type: 'jsonp',
extraParams: {
userName: 'admin',
userDomain: 'admin'
},
reader: {
root: ''
}
}
});

store.getProxy();
store.read();

Ext.create('Ext.Container', {
fullscreen: true,
layout: 'hbox',
items: [
{
xtype: 'toolbar',
docked: 'top',
height: 50,
scrollable: {
direction: 'horizontal',
indicators: false
},
items: [
{ ui: 'back',
text: 'Back',
handler: function () {
alert("dfdsf");
}
},
{ text: 'Default' },
{ ui: 'round', text: 'Round' },

{ xtype: 'spacer' },

{
xtype: 'segmentedbutton',
items: [
{ text: 'Option 1' },
{ text: 'Option 2', pressed: true },
{ text: 'Option 3' }
]
},

{ xtype: 'spacer' },

{ ui: 'action', text: 'Action' },
{ ui: 'forward', text: 'Forward' },
{
xtype: 'segmentedbutton',
allowMultiple: true,
items: [
{ text: 'Toggle 1', pressed: true },
{ text: 'Toggle 2', pressed: true },
{ text: 'Toggle 3' }
]
}
]
},
{
xtype: 'list',
disclosure: true,
onItemDisclosure: {
scope: 'test',
handler: function (record, btn, index) {
store.getProxy().url = 'http://localhost:8080/exampleJsonpService/ChildNodes?parentNodeId=' + record.get('NodeId');
store.load();
}
},
itemSelector: '.tweet',
itemTpl: tpl,
store: store,
flex: 1
},
{
xtype: 'panel',
html: 'message preview',
flex: 2
}
]

});

}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐