ext自定义类型

var _window = new Ext.form.FormPanel({
title:'查询条件',
renderTo: document.body,
width:820,
height:60,
frame:true,
items:[new Ext.Panel({
layout : 'column',
width :  810,
labelWidth :  70,
items : [{
layout : 'form',
width :  400,
items : [{
xtype:'textfield',
name:'resName',
fieldLabel:'资源名称',
id:'resName',
width:250
}]
}, {
layout : 'form',
width :  400,
labelWidth :  70,
items : [{
id:'resType',
xtype:'combo',
fieldLabel:'资源类型',
value:'',
readOnly:true,
triggerAction:'all',//设置触发数据的方式,默认是query
mode:'local',//这是数据提供的类型
displayField :'resType',//如果mode不是local就不需要写
store:new Ext.data.SimpleStore({
fields:["resType"],
data:[["CMDB资源"],["模型视图类"]]
}),

width:120
}]
}]
}),
new Ext.Panel({
layout : 'column',
width :  810,
labelWidth :  70,
items : [{
layout : 'form',
width :  400,
items : [{
xtype:'textfield',
name:'resDomain',
fieldLabel:'所属域',
id:'resDomain',
width:250
}]
}, {
layout : 'form',
width :  400,
labelWidth :  70,
items : [{
id:'permissionName',
xtype:'combo',
fieldLabel:'所属权限',
value:'',
readOnly:true,
triggerAction:'all',//设置触发数据的方式,默认是query
mode:'local',//这是数据提供的类型
displayField :'permissionName',//如果mode不是local就不需要写
store:new Ext.data.SimpleStore({
fields:["permissionName"],
data:[["生成工单"],["查看告警"],["查看资源详情"]]
}),

width:120
}]
}]
})],
buttons:[{
text:'查询',
handler:function(){
_store.reload();
}
},{
text:'条件清空',
handler:function(){
_window.getForm().reset();
}
}]
});


    var _column = new Ext.grid.ColumnModel([
    {dataIndex:"index",header:"序号",width:50,menuDisabled :true,align :'center'},
{dataIndex:"name",header:"资源名称",width:150,menuDisabled :true,align :'center'},//dataIndex是和store的数据字段绑定
{dataIndex:"resDomain",header:"所属域",width:150,menuDisabled :true,align :'center'},
{dataIndex:"resType",header:"资源类型",width:150,menuDisabled :true,align :'center'},//menuDisabled是让菜单没有子菜单
//{dataIndex:"sys",header:"所属系统",width:150,menuDisabled :true,align :'center'},
{dataIndex:"permissionName",header:"所属权限",width:300,menuDisabled :true,align :'center'}
]);
var _data = [
<s:iterator value="userAuthorResList" status="idx" >
[
'${name}',
'<s:property value="resourceClass.name"></s:property>',
'<s:property value="systemModule.name"></s:property>'
]
<s:if test="%{!#idx.last}">
,
</s:if>
</s:iterator>
];


/** var _store = new Ext.data.Store({
proxy:new Ext.data.MemoryProxy(_data),
reader:new Ext.data.ArrayReader({id:0},[
{name:'name'},
{name:'resType'},
{name:'sys'}
])
}); */
var _store = new Ext.data.JsonStore({
url:"/usermgr/user/user!authorRes.action",
root:"resultList",
totalProperty:"totalCount",
fields:["index","name","resType","sys","permissionName","resDomain"]
});
_store.on('beforeload', function() {
try{
var _resName = _window.findById('resName').getValue();
var _resType = _window.findById('resType').getValue();
var _resDomain = _window.findById('resDomain').getValue();
var _permissionName = _window.findById('permissionName').getValue();
var _params = 'command:"json",userId:"'+ document.getElementById('userId').value +'",deptId:"' + document.getElementById('deptId').value +'"';
if(_resName){
_params += ',resName:"' + _resName +'"';
}
if(_resType){
_params += ',resType:"' + _resType +'"';
}
if(_resDomain){
_params += ',resDomain:"' + _resDomain +'"';
}
if(_permissionName){
_params += ',permissionName:"' + _permissionName +'"';
}
_store.baseParams = eval('({'+ _params +'})');

}catch(e){}
});

_store.load();

var _gride = new Ext.grid.GridPanel({
id:'gri',
renderTo:Ext.getBody(),
width:820,
enableColumnMove : false,//控制列不能拖动
height :350,
colModel:_column,
store:_store,
selModel : new Ext.grid.RowSelectionModel({singleSelect:true})

});
_gride.render();

//-->
</script>

你可能感兴趣的:(json,ext)