/**
* DataList导出数据模板
*
* @author yingp
*/
Ext.define('erp.view.core.window.DataTemplate', {
extend: 'Ext.window.Window',
alias: 'widget.datatemplate',
title: '选择模板',
iconCls: 'x-button-icon-set',
height: screen.height*0.6,
width: screen.width*0.8,
maximizable : true,
buttonAlign : 'center',
layout : 'anchor',
caller : null,
initComponent: function() {
this.callParent(arguments);
this.show();
this.store = this.getDataTemplateStore(this.caller);
this.add(this.createDataView(this.store));
},
createDataView: function(store){
return Ext.create('Ext.view.View', {
anchor: '100% 70%',
bodyStyle: 'background:#f1f1f1;',
deferInitialRefresh: false,
store : store,
tpl: Ext.create('Ext.XTemplate',
'',
'',
(!Ext.isIE6? '

' :
'
'),
'
{name}',
'
{price:usMoney} ({reviews} Review{[values.reviews == 1 ? "" : "s"]})',
'
',
''
),
id: 'phones',
style: 'background:#f1f1f1;',
itemSelector: 'div.phone',
overItemCls : 'phone-hover',
multiSelect : true,
autoScroll : true
});
},
getDataTemplateStore : function(caller) {
Ext.define('DataTemplate', {
extend: 'Ext.data.Model',
fields: [
{name: 'DT_CALLER', type: 'string'},
{name: 'DT_DESC', type: 'string'},
{name: 'DT_MAN', type: 'string'},
{name: 'DT_DATE', type: 'string'},
{name: 'DT_FIELDS', type: 'string'}
]
});
return Ext.create('Ext.data.Store', {
model: 'DataTemplate',
proxy: {
type: 'ajax',
url: basePath + 'common/getFieldsDatas.action',
params: {
caller: 'DataTemplate',
fields: 'dt_fields,dt_desc,dt_man,to_char(dt_date,\'yyyy-mm-dd\')',
condition: 'dt_caller=\'' + caller + '\''
},
reader: {
type: 'json',
root: 'data'
}
},
autoLoad: true
});
}
});