bootgrid与confirmation兼容性问题

bootgrid通过插入command按钮可以实现对数据行的编辑功能,为了更好地做好前台,我使用了confirmation的插件做删除确认,但在实际使用中发现问题,目前已经解决grid reload后confirmation的页面元素全部初始化的问题。

注意红色部分

grid=$("#grid").bootgrid({
				ajax:true,
				ajaxSettings: {
			        method: "GET",
			        cache: false
			    },
			    selection:true,
				pagination: 3,
				rowCount:[30,20,10,-1],
				selection:true,
				rowSelect:true,
				labels: {
					infos: '{{ctx.start}} 至 {{ctx.end}} | 总数 {{ctx.total}}',
					search:'搜索档案名',
			        noResults: "您没有权限、登录超时或没有数据!"
			    },
				url:sy.contextPath + '/base/hyfile!grid.sy?QUERY_t%23syuserByCreateuserid.id_S_EQ='+'<%=sessionInfo.getUser().getId()%>',
				//url:sy.contextPath + '/test.json',
				formatters: { 
					 "classname":function(column, row){
						 return  row.fileproject.fileclass.name;
					 	},
					 "projectname":function(column, row){
						 return  row.fileproject.name;
					 	},
				     "timename":function(column, row){
						 return  row.filetime.name;
					 	},
				     "timekeepyear":function(column, row){
						 return  row.filetime.keepyear;
					 	},
					 "commands": function(column, row){
						 return "<button type=\"button\" class=\"btn btn-xs btn-warning command-edit\" data-row-id=\"" + row.id + "\"><span class=\"fa fa-pencil\"></span></button> " + 
						 "<button type=\"button\" class=\"btn btn-xs btn-danger command-delete\" data-toggle=\"confirmation\" data-row-id=\"" + row.id + "\"><span class=\"fa fa-trash-o\"></span></button> " +
						 "<button type=\"button\" class=\"btn btn-xs btn-success command-next\" data-toggle=\"confirmation\" data-row-flow=\"" + row.flow + "\" data-row-id=\"" + row.id + "\"><span class=\"fa fa-angle-right\"></span></button>";
					 	}
					 }
			}).on("loaded.rs.jquery.bootgrid", function()
		   	{
				$("#grid-footer").css("position","fixed");
				$("#grid-footer").css("bottom","-10px");
				$("#grid-footer").css("min-width","900px");
		       /* Executes after data is loaded and rendered */
		       grid.find(".command-edit").on("click", function(e)
		       {
		       	edit($(this).data("row-id"));
		        }).end().find(".command-delete").on("click", function(e)
		       {
		           //del($(this).data("row-id"));
		    	  $('.command-delete').confirmation({
		    		  title:'确认删除?',
		    		  btnOkClass:'btn-danger',
		    		  btnCancelClass:'btn-primary',
		    		  btnOkLabel:'<i class="glyphicon glyphicon-ok"></i> 是',
		    		  btnCancelLabel:'<i class="glyphicon glyphicon-remove"></i> 否',
		    		  onConfirm:function(){
		    			  del( $('.command-delete').data("row-id"));
		    			  $('.command-delete').confirmation('toggle');
		    		  },
		    		  <span style="color:#ff0000;"><strong>container: 'table',</strong></span>
		    		  singleton:true,
		    		  popout:true
		    	  }); 
		       }).end().find(".command-next").on("click", function(e)
		       {
		           //del($(this).data("row-id"));
		    	  $('.command-next').confirmation({
		    		  title:'确认发送下一步?',
		    		  btnOkClass:'btn-danger',
		    		  btnCancelClass:'btn-primary',
		    		  btnOkLabel:'<i class="glyphicon glyphicon-ok"></i> 是',
		    		  btnCancelLabel:'<i class="glyphicon glyphicon-remove"></i> 否',
		    		  onConfirm:function(){
		    			  //del($(this).data("row-id"));
		    			  sendToNext( $('.command-next').data("row-id"),$('.command-next').data("row-flow"));
		    			  $('.command-next').confirmation('toggle');
		    		  },
		    		  placement:'left',
		    		  <span style="color:#ff0000;"><strong>container: 'table',</strong></span>
		    		  singleton:true,
		    		  popout:true
		    	  });
		       });
		   });


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值