extjs3 TriggerField下拉出gridpanel

{  
                fieldLabel : "道路名称", 
                id:'manning_roadName_menu', 
                name : 'urbanRoadInfo.roadName',
                xtype : 'trigger',
                allowBlank : false,
                cls : "text-user",
				blankText : "不能为空",
				triggerClass: 'x-form-search-trigger',
                cls:"ux-readOnly", //增加此样式,可以变灰 
                emptyText:'请选择道路',
                enableKeyEvents: true,
                onTriggerClick : function(){
		                	if(this.menu == null){
				                this.menu = new Ext.menu.Menu({
				                	    scope:this,
								        items: new Pengtu.contract.ManningSeletorPanel({cid:this.cid,type:1})
								 });
		                	}
				           this.menu.show(this.el,"tl-bl?");
						} 
            }
Ext.namespace("Pengtu.contract");
Pengtu.contract.ManningSeletorPanel = Ext.extend(Ext.Panel, { 
	width:600,
	height:400,
	frame : false, 
	layout : "border",
    store : null,
    cid:null,//合同
    type:null, //1.道路2.桥梁3.斜坡
    //初始化函数  
    initComponent:function(){  
    	Pengtu.contract.ManningSeletorPanel.superclass.initComponent.call(this);
    	if(!this.store){
    		this.store = new Ext.data.Store({
    			remoteSort : true,
    			baseParams : {
    				lightWeight : true,
    				ext : 'js'
				},
				proxy: new Ext.data.HttpProxy({ 
					url : appConfig.contPath + '/dl/urbanroadinfo!list.action',
					method : 'post'
				}),
				reader : new Ext.data.JsonReader({
					root : 'results',
					totalProperty : 'totalCounts',
					id : 'id',
					fields : [ {
						name : 'id',
						type : 'string'
					},{
						name : 'roadId',
						type : 'string'
					},{
						name : 'roadName',
						type : 'string'
					},{
						name : 'roadGrade',
						type : 'string'
					},{
						name : 'inspectTime',
						convert : Pengtu.extapp.convertToDate
					},{
						name : 'weather',
						type : 'string'
					}, {
						name : 'upOrDown',
						type : 'string'
					}, {
						name : 'location',
						type : 'string'
					}, {
						name : 'district',
						type : 'string'
					}, {
						name : 'street',
						type : 'string'
					}, {
						name : 'landmark',
						type : 'string'
					}, {
						name : 'pegNumber',
						type : 'string'
					}, {
						name : 'Describe',
						type : 'string'
					}, {
						name : 'lon',
						type : 'string'
					}, {
						name : 'lat',
						type : 'string'
					}, {
						name : 'remark',
						type : 'string'
					}, {
						name : 'isdeal',
						type : 'string'
					}, {
						name : 'createDate',
						convert : Pengtu.extapp.convertToDate
					} ]
				})
			});
    	}
    	
    	this.sm = new Ext.grid.CheckboxSelectionModel({singleSelect:false});
        this.viewgrid = new Ext.grid.GridPanel({
        	columnLines: true,
			width : 300,
			height : 200,
			frame : false,
			header:false,
			title : '道路列表',
			region : 'center',
			store : this.store,
			cm : new Ext.grid.ColumnModel(
				[   this.sm,
					new Ext.grid.RowNumberer({
						width : 40,
						header : "序号"
					}),
					{
						header : "道路名称",
						dataIndex : 'roadName',
						width : 150,
						sortable : true
					}, {
						header : "道路类别",
						dataIndex : 'roadGrade',
						width : 150,
						sortable : true
					}, {
						header : "检查时间 ",
						dataIndex : 'inspectTime',
						renderer : Pengtu.extapp.Format.formatDateRenderer,
						width : 150,
						sortable : true
					}, {
						header : "当前天气",
						dataIndex : 'weather',
						width : 150,
						sortable : true
					}, {
						header : "损坏类别",
						dataIndex : 'damageKind',
						width : 150,
						sortable : true
					}, {
						header : "左右幅",
						dataIndex : 'upOrDown',
						width : 150,
						sortable : true
					}, {
						header : "当前位置",
						dataIndex : 'location',
						width : 150,
						sortable : true
					},{
						header : "发现问题",
						dataIndex : 'describe',
						width : 150,
						sortable : true
					},{
						header : "是否处理",
						dataIndex : 'isdeal',
						width : 150,
						sortable : true
					},{
						header : "备注",
						dataIndex : 'remark',
						width : 150,
						sortable : true
					},{
						id : 'createDate',
						header : "创建时间",
						dataIndex : 'createDate',
						renderer : Pengtu.extapp.Format.formatDateRenderer,
						width : 150,
						sortable : true
					} 
				]
			),
			bbar : new Ext.PagingToolbar({
       		    store : this.store,
       		    pageSize : 100,
       		    displayInfo : true
       	    }),
            sm : this.sm,
			view : new Ext.ux.grid.BufferView({
				rowHeight : 30,
				scrollDelay : false
			}),
			loadMask : {
		         msg : '正在努力加载,请稍后....'
		    },
			listeners : {
				'render' : function(grid){
					this.reloadData();
				},scope:this
			},
			tbar : [
			        { text : '道路名称:'}, 
			        new Ext.form.TextField({
			        	id : 's_roadName',
			       		width : 100,
			       		allowBlank : true
			        }),
			       	{ text : '检查时间:'},
			       	new Ext.form.TextField({
			       		id : 's_road_inspectTime',
				   		width : 100,
				   		allowBlank : true
			       	}),
				   	{ 	
			       		text : "搜 索",
			       		iconCls: 'bt_search',
			       		handler: function(){
			       			var value1 = Ext.getCmp("s_roadName").getValue();
			       			var value2 = Ext.getCmp("s_road_inspectTime").getValue();
			       			this.store.load({params : {
			       				'filter_LIKES_roadName':value1,
			       				'filter_LIKES_inspectTime':value2
			       			}});
			       		},scope : this
			       	},{
			       		text:"确定",
			       		iconCls:'bt_save',
			       		handler:function(){
			       			var field = Ext.getCmp("manning_roadName_menu");
			       			var gsm = this.viewgrid.getSelectionModel();
			       			var rows = gsm.getSelections();
			       			var roadIds = "";
			       			var roadNames = ""
			       			if(rows.length>0){
			       				for(var i=0; i<rows.length;i++){
			       					var row = rows[i];
			       					var id = row.get('id');
			       					var roadName = row.get("roadName");
			       					roadIds = roadIds + "#" + id;
			       					roadNames = roadName + ","+ roadNames;
			       				}
			       			}
			       			field.setValue(roadNames);
			       			field.menu.hide();
			       		},scope : this
			       	}]
		});
       
        this.add(this.viewgrid);
    },
    
    reloadData : function() {
		this.store.load({
			params : {
				'page.startRow' : 0,
				'page.pageSize' : 100
			}
		});
	},
    
    addData : function(){
    
    },
    saveData : function() {
		
	},
    deleteData : function() {
		
	},
     location : function() {
		
	},
	searchData : function() {
		alert("查找Code");
	}
});  


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值