`
onlydo
  • 浏览: 165554 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

按钮列

阅读更多
使用Ext.ux.grid.RowActions.js,使用样例如下:
<script type="text/javascript" src="http://localhost/extjs/ux/Ext.ux.grid.RowActions.js"></script>

this.rowActions = new Ext.ux.grid.RowActions({
			 header:'操作'			
			,autoWidth:false
			,hideMode:'display'
			,keepSelection:true
			,actions:[{
				 iconCls:'icon-publish'
				,tooltip:'发布'
				//,text:'发布'
				,hideIndex:'PUBLISH'
				,callback:function(grid, records, action,rowIndex,colIndex) {						
					Ext.Ajax.request( {
						url :'info/changeStatus.do',
						params : {
							'id' :records.get('ID'),
							'status' :'1'
						},
						method :'POST',
						success : function(response) {
							var r = Ext.decode(response.responseText);
							if (!r.success)
								Ext.Msg.alert('提示信息', '发布失败,由以下原因所致:<br/>'
										+ (r.errors.msg ? r.errors.msg : '未知原因'));
							else {
								grid.store.reload();
							}
						},
						scope :this
					});
				}
			},{
				iconCls:'icon-unpublish'
				,tooltip:'撤回'
				//,text:'撤回'
				,hideIndex:'UNPUBLISH'
				,callback:function(grid, records, action,rowIndex,colIndex) {						
					Ext.Ajax.request( {
						url :'info/changeStatus.do',
						params : {
							'id' :records.get('ID'),
							'status' :'2'
						},
						method :'POST',
						success : function(response) {
							var r = Ext.decode(response.responseText);
							if (!r.success)
								Ext.Msg.alert('提示信息', '发布失败,由以下原因所致:<br/>'
										+ (r.errors.msg ? r.errors.msg : '未知原因'));
							else {
								grid.store.reload();
							}
						},
						scope :this
					});
				}
			},{
				 iconCls:'icon-totopas'
				,tooltip:'置顶'
				//,text:'置顶'
				,hideIndex:'TOTOPAS'
				,callback:function(grid, records, action,rowIndex,colIndex) {							
					Ext.Ajax.request( {
						url :'info/changeTopas.do',
						params : {
							'id' :records.get('ID'),
							'topas' :'1'
						},
						method :'POST',
						success : function(response) {
							var r = Ext.decode(response.responseText);
							if (!r.success)
								Ext.Msg.alert('提示信息', '置顶失败,由以下原因所致:<br/>'
										+ (r.errors.msg ? r.errors.msg : '未知原因'));
							else {
								grid.store.reload();
							}
						},
						scope :this
					});
				}
			},{
				 iconCls:'icon-untopas'
				,tooltip:'取消置顶'
				//,text:'取消置顶'
				,hideIndex:'UNTOPAS'
				,callback:function(grid, records, action,rowIndex,colIndex) {							
					Ext.Ajax.request( {
						url :'info/changeTopas.do',
						params : {
							'id' :records.get('ID'),
							'topas' :'0'
						},
						method :'POST',
						success : function(response) {
							var r = Ext.decode(response.responseText);
							if (!r.success)
								Ext.Msg.alert('提示信息', '置顶失败,由以下原因所致:<br/>'
										+ (r.errors.msg ? r.errors.msg : '未知原因'));
							else {
								grid.store.reload();
							}
						},
						scope :this
					});
				}
			},{
				 iconCls:'icon-view'
				,tooltip:'预览'
				//,text:'预览'						
				,callback:function(grid, records, action,rowIndex,colIndex) {	
					window.open('info/view.do?id='+records.get('ID'));							
				}
			}]
		});		
		this.plugins = [this.rowActions];	
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics