?? professorsearchgrid.js
字號(hào):
function formatDate(value){
return value ? value.dateFormat('Y-m-d') : '';
};
function newProfessorSearchGrid(title,paramValue){
var professorSearchGrid;
var page=1;
var tableName="professor";
var Record=Ext.data.Record.create(
[{name:"name"},{name:"clergy"},{name:"sex"},{name:"id"},{name:"nationality"},
{name:"birthday",type:"date",dateFormat:"Y-m-d"},{name:"idcard"},{name:"origin"},{name:"birthplace"},{name:"accountplace"},
{name:"education"},{name:"theologyeducation"},{name:"baptismtime",type:"date",dateFormat:"Y-m-d"},{name:"baptismplace"},
{name:"ordinationtime",type:"date",dateFormat:"Y-m-d"},{name:"ordinationplace"},{name:"authenticationtime",type:"date",dateFormat:"Y-m-d"},{name:"authenticationunit"},
{name:"recordtime",type:"date",dateFormat:"Y-m-d"},{name:"recorddepartment"},{name:"church"},{name:"duty"},
{name:"phone"},{name:"postcode"},{name:"interest"},{name:"foreignlanguage"},{name:"photo"}
]
);
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);
if(!professorSearchGridCm){
//Ext.Msg.alert("",store.getAt(0).get("id"));
professorSearchGridCm=new Ext.grid.ColumnModel([
{header:"序號(hào)",dataIndex:"id",width:40},
{header:"姓名",dataIndex:"name",width:80,
editor:new Ext.form.TextField({
})},
{header:"宗教教職",dataIndex:"clergy",width:80,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"proGrid-clergy",
lazyRender:true
})},
{header:"性別",dataIndex:"sex",width:80,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"proGrid-sex",
lazyRender:true
})},
{header:"民族",dataIndex:"nationality",width:80,
editor:new Ext.form.TextField({
})
},
{header:"出生年月",dataIndex:"birthday",width:80,
renderer:formatDate,
editor:new Ext.form.DateField({
format:"Y-m-d"
})},
{header:"身份證號(hào)",dataIndex:"idcard",width:80,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"籍貫",dataIndex:"origin",width:80,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"proGrid-origin",
lazyRender:true
})},
{header:"出生地",dataIndex:"birthplace",width:80,
editor:new Ext.form.TextField({
})},
{header:"戶口所在地",dataIndex:"accountplace",width:80,
editor:new Ext.form.TextField({
})},
{header:"文化程度",dataIndex:"education",width:80,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"proGrid-education",
lazyRender:true
})},
{header:"神學(xué)教育",dataIndex:"theologyeducation",width:80,
editor:new Ext.form.TextField({
})},
{header:"受洗時(shí)間",dataIndex:"baptismtime",width:80,
renderer:formatDate,
editor:new Ext.form.DateField({
format:"Y-m-d"
})},
{header:"受洗地點(diǎn)",dataIndex:"baptismplace",width:80,
editor:new Ext.form.TextField({
})},
{header:"按立時(shí)間",dataIndex:"ordinationtime",width:80,
renderer:formatDate,
editor:new Ext.form.DateField({
format:"Y-m-d"
})},
{header:"按立地點(diǎn)",dataIndex:"ordinationplace",width:80,
editor:new Ext.form.TextField({
})},
{header:"認(rèn)定時(shí)間",dataIndex:"authenticationtime",width:80,
renderer:formatDate,
editor:new Ext.form.DateField({
format:"Y-m-d"
})},
{header:"認(rèn)定單位",dataIndex:"authenticationunit",width:80,
editor:new Ext.form.TextField({
})},
{header:"備案時(shí)間",dataIndex:"recordtime",width:80,
renderer:formatDate,
editor:new Ext.form.DateField({
format:"Y-m-d"
})},
{header:"備案部門(mén)",dataIndex:"recorddepartment",width:80,
editor:new Ext.form.TextField({
})},
{header:"所在教堂或單位",dataIndex:"church",width:80,
editor:new Ext.form.TextField({
})},
{header:"工作職務(wù)",dataIndex:"duty",width:80,
editor:new Ext.form.TextField({
})},
{header:"聯(lián)系電話",dataIndex:"phone",width:80,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"郵政編碼",dataIndex:"postcode",width:80,
editor:new Ext.form.NumberField({
allowNegative:false
})},
{header:"特長(zhǎng)愛(ài)好",dataIndex:"interest",width:80,
editor:new Ext.form.TextField({
})},
{header:"外國(guó)語(yǔ)種",dataIndex:"foreignlanguage",width:80,
editor:new Ext.form.ComboBox({
typeAhead:true,
triggerAction:"all",
transform:"proGrid-foreignlanguage",
lazyRender:true
})}
]);
}
function add(){
addTool(professorSearchGrid,++professortableCount);
}
function nextPage(){
page=nextPageTool(professorSearchGrid,page);//由于這里的page和pagingToolBar的page不同步,所以要么只用鼠標(biāo),要么只用鍵盤(pán),來(lái)加載下一頁(yè)。
}
function previousPage(){
page=previousPageTool(professorSearchGrid,page);
}
function remove(){
removeTool(professorSearchGrid,tableName);
}
function uploadPhoto(){
uploadPhotoTool(professorSearchGrid,tableName);
}
function newForm(){
newFormTool(professorSearchGrid,tableName);
}
professorSearchGrid=new Ext.grid.EditorGridPanel({
id:"professorSearchGrid"+(++window.professorSearchCount),
title:title,
store:store,
height:document.documentElement.clientHeight,
height:500,
cm: professorSearchGridCm,
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}),//設(shè)置可多行選中模式
bbar: new Ext.PagingToolbar({
pageSize:24,
store: store,
displayInfo: true,
displayMsg: "共有記錄 {2}行 : {0} 到 {1}",//這里的{0}..不知道在哪里找
emptyMsg: "沒(méi)有信息可以顯示"
}),
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}});
professorSearchGrid.addListener("afteredit",function(grid){
var f=grid.field;
var v=grid.value;
var r=grid.record;
var paramValue=paramEditValue(r,f,v);
editRequest("professor",paramValue);
})
store.addListener("add",function(store,records){
var paramValue={
id:records[0].get("id")
}
addRequest("professor",paramValue);
})
//Ext.Msg.alert("",professorSearchGrid.getStore().getAt(0).get("othernumber"))
professorSearchGrid.addListener("load",function(){
page++;
})
return professorSearchGrid;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -