?? lorgsearchgrid.js
字號:
function formatDate(value){
return value ? value.dateFormat('Y-m-d') : '';
};
function newLoRgSearchGrid(title,paramValue){
//Ext.Msg.alert("",123);
var loRgSearchGrid;
var page=1;
var tableName="locationreg";
var Record=Ext.data.Record.create(
[{name:"id"},{name:"locationdistrict"},{name:"locationaddress"},{name:"locationname"},{name:"locationregdate",type:"date",dateFormat:"Y-m-d"},
{name:"locationregid"},{name:"locationcatogory"},{name:"locationsect"},{name:"locationconstructarea"},{name:"locationconversarea"},{name:"locationpostcode"},
{name:"locationphone"},{name:"staffnumber"},{name:"othernumber"},{name:"locationadmin"},{name:"sex"},{name:"idcard"},{name:"nationality"},
{name:"education"},{name:"address"},{name:"clergy"},{name:"outerwork"},{name:"photo"},{name:"birthday",type:"date",dateFormat:"Y-m-d"}
]
);
//Ext.Msg.alert("",234);
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(!loRgSearchGridCm){
//Ext.Msg.alert("","4");
loRgSearchGridCm=new Ext.grid.ColumnModel([
{header:"序號",dataIndex:"id",width:40},
{header:"所在區",dataIndex:"locationdistrict",width:100,
editor:new Ext.form.ComboBox({
transform:"loGrid-locationdistrict",
triggerAction:"all",
typeAhead:true,
lazyRender:true
})},
{header:"場所地址",dataIndex:"locationaddress",width:121,
editor:new Ext.form.TextField({
})},
{header:"場所名稱",dataIndex:"locationname",width:121,
editor:new Ext.form.TextField({
})},
{header:"批準時間",dataIndex:"locationregdate",width:100,
renderer:formatDate,
editor:new Ext.form.DateField({
format:"Y-m-d"
})},
{header:"登記證號",dataIndex:"locationregid",width:90,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"登記類別",dataIndex:"locationcatogory",width:100,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"loGrid-locationcatogory",
lazyRender:true
})},
{header:"教派",dataIndex:"locationsect",width:100,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"loGrid-locationsect",
lazyRender:true
})},
{header:"場所建筑面積",dataIndex:"locationconstructarea",width:80,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"場所占地面積",dataIndex:"locationconversarea",width:80,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"場所郵編",dataIndex:"locationpostcode",width:80,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"場所電話",dataIndex:"locationphone",width:90,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"教職人員數",dataIndex:"staffnumber",width:90,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"其他人員數",dataIndex:"othernumber",width:90,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"場所主負責人",dataIndex:"locationadmin",width:100,
editor:new Ext.form.TextField({
})},
{header:"性別",dataIndex:"sex",width:90,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"loGrid-sex",
lazyRender:true
})},
{header:"出生年月",dataIndex:"birthday",width:100,
renderer:formatDate,
editor:new Ext.form.DateField({
format:"Y-m-d"
})},
{header:"身份證號",dataIndex:"idcard",width:90,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"民族",dataIndex:"nationality",width:100,
editor:new Ext.form.TextField({
})},
{header:"文化程度",dataIndex:"education",width:100,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"loGrid-education",
lazyRender:true
})},
{header:"家庭住址",dataIndex:"address",width:100,
editor:new Ext.form.TextField({
})},
{header:"宗教教職",dataIndex:"clergy",width:100,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"loGrid-clergy",
lazyRender:true
})},
{header:"場所以外工作單位及職務",dataIndex:"outerwork",width:100,
editor:new Ext.form.TextField({
})
}
]);
}
function add(){
addTool(loRgSearchGrid,++LoRgtableCount);
}
function nextPage(){
page=nextPageTool(loRgSearchGrid,page);//由于這里的page和pagingToolBar的page不同步,所以要么只用鼠標,要么只用鍵盤,來加載下一頁。
}
function previousPage(){
page=previousPageTool(loRgSearchGrid,page);
}
function remove(){
removeTool(loRgSearchGrid,tableName);
}
function uploadPhoto(){
uploadPhotoTool(loRgSearchGrid,tableName);
}
function newForm(){
newFormTool(loRgSearchGrid,tableName);
}
loRgSearchGrid=new Ext.grid.EditorGridPanel({
id:"loRgSearchGrid"+(++window.loRgSearchCount),
title:title,
store:store,
autoSelect:true,
height:document.documentElement.clientHeight,
height:500,
cm: loRgSearchGridCm,
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:"upload",
handler:uploadPhoto
},{
text:"打印記錄",
iconCls:"printing",
handler:newForm
}]
});
store.load({params:{start:0, limit:24}});
loRgSearchGrid.addListener("afteredit",function(grid){
var f=grid.field;
var v=grid.value;
var r=grid.record;
var paramValue=paramEditValue(r,f,v);
editRequest("locationreg",paramValue);
})
store.addListener("add",function(store,records){
var paramValue={
id:records[0].get("id")
}
addRequest("locationreg",paramValue);
})
//Ext.Msg.alert("",loRgSearchGrid.getStore().getAt(0).get("othernumber"))
loRgSearchGrid.addListener("load",function(){
page++;
})
return loRgSearchGrid;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -