⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 professorsearchgrid.js

📁 重点不是信息管理系统
💻 JS
字号:
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:"序号",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:"身份证号",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:"神学教育",dataIndex:"theologyeducation",width:80,
		    editor:new Ext.form.TextField({		
		  	})},
		    {header:"受洗时间",dataIndex:"baptismtime",width:80,
		    renderer:formatDate,
		    editor:new Ext.form.DateField({
		    	format:"Y-m-d"
		    })},
		    {header:"受洗地点",dataIndex:"baptismplace",width:80,
		    editor:new Ext.form.TextField({		
		  	})},
		    {header:"按立时间",dataIndex:"ordinationtime",width:80,
		    renderer:formatDate,
		    editor:new Ext.form.DateField({
		    	format:"Y-m-d"
		    })},
		    {header:"按立地点",dataIndex:"ordinationplace",width:80,
		    editor:new Ext.form.TextField({		
		  	})},
		    {header:"认定时间",dataIndex:"authenticationtime",width:80,
		    renderer:formatDate,
		    editor:new Ext.form.DateField({
		    	format:"Y-m-d"
		    })},
		    {header:"认定单位",dataIndex:"authenticationunit",width:80,
		    editor:new Ext.form.TextField({		
		  	})},
		    {header:"备案时间",dataIndex:"recordtime",width:80,
		    renderer:formatDate,
		    editor:new Ext.form.DateField({
		    	format:"Y-m-d"
		    })},
		    {header:"备案部门",dataIndex:"recorddepartment",width:80,
		    editor:new Ext.form.TextField({		
		  	})},
		     {header:"所在教堂或单位",dataIndex:"church",width:80,
		    editor:new Ext.form.TextField({		
		  	})},
		    {header:"工作职务",dataIndex:"duty",width:80,
		    editor:new Ext.form.TextField({		
		  	})},
		    {header:"联系电话",dataIndex:"phone",width:80,
		    editor:new Ext.form.NumberField({
		    	allowNegative:false
		    })},
		    {header:"邮政编码",dataIndex:"postcode",width:80,
		    editor:new Ext.form.NumberField({
		    	allowNegative:false
		    })},
		    {header:"特长爱好",dataIndex:"interest",width:80,
		    editor:new Ext.form.TextField({		
		  	})},
		    {header:"外国语种",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不同步,所以要么只用鼠标,要么只用键盘,来加载下一页。
	 }
	 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}),//设置可多行选中模式
		    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}});
	 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;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -