layui重载表格

笔记本添加成功以后,点击弹出层右上角的叉号以后,页面自动刷新表格
在这里插入图片描述主要的js代码

	 cancel:function(index,layero){
		  table.reload('demo', {
			 page: {
			    curr: 1 //重新从第 1 页开始
			  }
		 
			}); 
layui.use([ 'layer', 'table',  "laypage","jquery"], function(){
    
    
  var 
    layer = layui.layer //弹层
   ,table = layui.table //表格
   ,laypage = layui.laypage //分页
   ,$ = layui.jquery
   //addnotebook是页面上的添加按钮
     $('#addnotebook').on("click",function(){
    
    
	  layer.open({
    
    
		  area:['500px','300px'],
		  shadeClose:true,//点击旁边地方自动关闭
		  anim:2,
		  type: 2, 
		  content: 'notebook_add.html', //这里content是一个URL,如果你不想让iframe出现滚动条,你还可以content: ['http://sentsin.com', 'no']
		  cancel:function(index,layero){
    
    
			  table.reload('demo', {
    
    
				 page: {
    
    
				    curr: 1 //重新从第 1 页开始
				  }
			 
				}); //只重载数据
			   layer.close(index);
		        return false;
		   }
						
	  });
  });  
});

猜你喜欢

转载自blog.csdn.net/ifyouwjk/article/details/106191165