📄 unlorgsearchgrid.js
字号:
function formatDate(value){
return value ? value.dateFormat('Y-m-d') : '';
};
function newUnLoRgSearchGrid(title,paramValue){
//Ext.Msg.alert("",data.success);
var unLoRgSearchGrid;
var tableName="unlocationreg";
var page=1;
var Record=Ext.data.Record.create(
[{name:"locationdistrict"},{name:"locationaddress"},{name:"locationsect"},{name:"id"},{name:"believersnumber"},
{name:"housingarea"},{name:"housingproperty"},{name:"establishmenttime" ,type:"date",dateFormat:"Y-m-d"},{name:"actiontime",type:"date",dateFormat:"Y-m-d"},{name:"admin"},
{name:"placeproperty"},{name:"managesituation"},{name:"submittime",type:"date",dateFormat:"Y-m-d"},{name:"exception"}
]
);
var store = new Ext.data.JsonStore({
url:"/servlet/search.do?tableName="+tableName,
baseParams:paramValue,
totalProperty:"totalProperty",
root: "row",
id:"id",
fields:Record
});
//Ext.Msg.alert("",store.getAt(0).get("id"));
if(!unLoRgSearchGridCm){
//Ext.Msg.alert("",store.getAt(0).get("id"));
unLoRgSearchGridCm=new Ext.grid.ColumnModel([
{header:"序号",dataIndex:"id",width:40},
{header:"所在区",dataIndex:"locationdistrict",width:100,
editor:new Ext.form.ComboBox({
transform:"unlGrid-locationdistrict",
triggerAction:"all",
typeAhead:true,
lazyRender:true
})
},
{header:"场所地址",dataIndex:"locationaddress",width:121,
editor:new Ext.form.TextField({
})
},
{header:"教派",dataIndex:"locationsect",width:100,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"unlGrid-locationsect",
lazyRender:true
})},
{header:"信徒人数",dataIndex:"believersnumber",width:80,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"房屋面积",dataIndex:"housingarea",width:80,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"房屋属性",dataIndex:"housingproperty",width:100,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"unlGrid-housingproperty",
lazyRender:true
})},
{header:"设立时间",dataIndex:"establishmenttime",width:100,
renderer:formatDate,
editor:new Ext.form.DateField({
format:"Y-m-d"
})},
{header:"活动时间",dataIndex:"actiontime",width:100,
renderer:formatDate,
editor:new Ext.form.DateField({
format:"Y-m-d"
})},
{header:"负责人",dataIndex:"admin",width:121,
editor:new Ext.form.TextField({
})},
{header:"场所属性",dataIndex:"placeproperty",width:100,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"unlGrid-placeproperty",
lazyRender:true
})},
{header:"管理情况",dataIndex:"managesituation",width:121,
editor:new Ext.form.TextField({
})},
{header:"报送时间",dataIndex:"submittime",width:100,
renderer:formatDate,
editor:new Ext.form.DateField({
format:"Y-m-d"
})},
{header:"异动情况",dataIndex:"exception",width:121,
editor:new Ext.form.TextField({
})}
]);
}
function add(){
addTool(unLoRgSearchGrid,++unLoRgtableCount);
}
function nextPage(){
page=nextPageTool(unLoRgSearchGrid,page);//由于这里的page和pagingToolBar的page不同步,所以要么只用鼠标,要么只用键盘,来加载下一页。
}
function previousPage(){
page=previousPageTool(unLoRgSearchGrid,page);
}
function remove(){
removeTool(unLoRgSearchGrid,tableName);
}
function newForm(){
newFormTool(unLoRgSearchGrid,tableName);
}
unLoRgSearchGrid=new Ext.grid.EditorGridPanel({
id:"unLoRgSearchGrid"+(++window.unLoRgSearchCount),
title:title,
store:store,
height:document.documentElement.clientHeight,
height:500,
cm: unLoRgSearchGridCm,
keys:[{
key:"q",
shift: true,
fn: add
},{
key:"o",
shift:true,
fn:add
},{
key:"d",
shift:true,
fn:remove
},{
key:Ext.EventObject.DELETE,
fn:remove
},{
key:Ext.EventObject.PAGEDOWN,
fn:nextPage
},{
key:Ext.EventObject.PAGEUP,
fn:previousPage
}],
forceFit:true,
//loadMask :true,
frame:true,
clicksToEdit:1,
closable:true,
selModel: new Ext.grid.RowSelectionModel({singleSelect:false}),//设置可多行选中模式
bbar: new Ext.PagingToolbar({
pageSize:24,
store: store,
displayInfo: true,
displayMsg: "共有记录 {2}行 : {0} 到 {1}",//这里的{0}..不知道在哪里找
emptyMsg: "没有信息可以显示"
}),
tbar: [{
text: "添加",
iconCls:"add",
handler :add
},{
text: "删除所选",
iconCls:"remove",
handler : remove
},{
text:"打印记录",
iconCls:"printing",
handler:newForm
}]
});
store.load({params:{start:0, limit:24}});
unLoRgSearchGrid.addListener("afteredit",function(grid){
var f=grid.field;
var v=grid.value;
var r=grid.record;
var paramValue=paramEditValue(r,f,v);
editRequest("unlocationreg",paramValue);
})
store.addListener("add",function(store,records){
var paramValue={
id:records[0].get("id")
}
addRequest("unlocationreg",paramValue);
})
//Ext.Msg.alert("",unLoRgSearchGrid.getStore().getAt(0).get("othernumber"))
unLoRgSearchGrid.addListener("load",function(){
page++;
})
return unLoRgSearchGrid;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -