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

📄 lorgsearchgrid.js

📁 重点不是信息管理系统
💻 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 + -