layui实现动态显示表格按钮

{
    title: '操作',
    fixed: 'right',
    minWidth:220,
    align:'center',
    toolbar:"#barDemo"
    // templet:methods.checkButton
}

1.用toolbar渲染


注意:必须用d去取值,d为layui表格自带的

2.用templet渲染

checkButton:function (data) {
 if(data!=null){
  var html = "";
  html +=  '明细'
  if(data.rewPenStatus == 'confirmation'){// 状态为确认中
   html += '编辑'
   if(data.source == '手工维护'){
    html += '删除'
   }
   html += '确认'
   if(data.source != '手工维护'){
    html += '退回'
   }
  }
  return html;
 }
}

你可能感兴趣的:(前端,layui,layui,动态加载表格)