Ext.define('ShuJuYuanModel', {
extend: 'Ext.data.Model',
fields:[
'type', 'displayMode', 'classfield', 'ValueField','StatisticalMethod','id'
]
});
var resMainInfoId = $("#resMainInfoId").val();
var ZYMLZiYuanStore = new Ext.data.Store({
autoDestroy: true,
pageSize: 10,
model: 'ShuJuYuanModel',
proxy: {
type: 'ajax',
url: '/res/common/TuXingConfigSelectAll?resourceid='+resMainInfoId,
reader: {
root: 'topics',
totalProperty: 'totalCount'
},
simpleSortMode: true
},
remoteSort: true
});
var formdata = {};
Ext.onReady(function () {
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.tip.QuickTipManager.init();
Ext.Ajax.timeout = 900000;
Ext.require([
'Ext.ux.PagingToolbar'
]);
Ext.create('Ext.grid.Panel', {
id: 'gridexample',
renderTo: 'grid',
// height: 460,
layout: 'fit',
autoScroll: false,
store: ZYMLZiYuanStore,
stateful: false,
viewConfig: {
forceFit: true,
enableTextSelection: true //列表数据可复制
},
columns: [
{ xtype: 'rownumberer', text: "序号", width: '5%', align: 'center' },
{ text: "图形样式", dataIndex: 'type', width: '15%', sortable: false, align: 'center', filter: { type: 'string' }},
{ text: "显示模式", dataIndex: 'displayMode', width: '16%', sortable: false, align: 'center', filter: { type: 'string' }},
{ text: "类别字段", dataIndex: 'classfield', width: '15%', sortable: false, align: 'center', filter: { type: 'string' }},
{ text: "选择字段", dataIndex: 'ValueField', width: '16%', sortable: false, align: 'center', filter: { type: 'string' }},
{ text: "统计方式", dataIndex: 'StatisticalMethod', width: '16%', sortable: false, align: 'center', filter: { type: 'string' }},
{ text: "操作", dataIndex: 'id', width: '16%', sortable: false, align: 'center', filter: { type: 'string' },
renderer: function (value, p, record) {
return Ext.String.format(
'编辑 删除',
value
);
}
},
],
bbar: Ext.create('Ext.ux.PagingToolbar', {
id: "Page",
name: "Page",
store: ZYMLZiYuanStore,
displayInfo: true,
firstText: "首页",
prevText: "上一页",
nextText: "下一页",
lastText: "尾页",
refreshText: '刷新',
beforePageText: '第',
afterPageText: '页,共 {0} 页',
displayMsg: '显示 {0} - {1} 条,共 {2} 条',
emptyMsg: "没有数据显示",
items: [
{
xtype: 'label',
text: ''
}
]
})
});
ZYMLZiYuanStore.on('beforeload', function () {
ZYMLZiYuanStore.proxy.extraParams = [];
Ext.apply(ZYMLZiYuanStore.proxy.extraParams, formdata);
});
ZYMLZiYuanStore.on('load', function (store, records, successful, eOpts) {
var totalCount = store.totalCount;
if (totalCount == "") totalCount = "0";
});
ZYMLZiYuanStore.load();
//添加resize监听防止切换tab或者收起左栏导致grid不自适应宽度
$(window).resize(function () {
Ext.getCmp('gridexample').doLayout();//panel重新布局
});
});
function Clear() {
document.getElementById("SearchForm").reset();
}
function Search() {
Ext.getCmp('gridexample').dockedItems.items[1].store.currentPage = 1;
ZYMLZiYuanStore.load();
}
//关闭窗口
function closeLayer(){
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
parent.layer.close(index);
}
function OpenZiYuan(id) {
var resMainInfoId = $("#resMainInfoId").val();
var url = "/res/common/resource_add_TuXin?resourceid="+resMainInfoId+"&id="+id;
layer.open({
type: 2,
title: '添加设置',
id: 'tianjia',
shadeClose: true,
shade: 0.7,
maxmin: false, //开启最大化最小化按钮
area: ['800px', '550px'],
content: url
});
}
function delect(id) {
var resMainInfoId = $("#resMainInfoId").val();
if (confirm("删除图形设置,确定删除吗?")) {
$.ajax({
url: "/res/common/TuXinCongiDelect?resourceid="+resMainInfoId+"&hangshu="+id,
type: 'post',
dataType: 'text',
data: {},
success: function (data) {
var json = eval('('+data+')');
if (json.count == "1") {
alert("删除成功!");
window.location.reload(); //刷新父页面
} else {
alert("删除失败!");
}
},
error: function (e) {
alert(e.message);
}
});
}
}