bootstrap table 检索数据默认checkbox全部勾选


通过JavaScript启用bootstrap table,有个columns值,如下,在第一项中加入formatter属性(红色部分)

 columns: [{ field: 'state', checkbox: true,
formatter:checkboxFormatter
 }, { field: 'id', title: 'Item ID', align: 'right', valign: 'bottom', sortable: true }, { field: 'name', title: 'Item Name', align: 'center', valign: 'middle', sortable: true, formatter: nameFormatter }]
再定义一个函数
function checkboxFormatter(){

          var result = new Object;
          result.checked =true;
           result.disabled = false;
           row['state'] = true;
          return result;

}
如果以上函数没写红色部分,table中表现复选框勾选,但在获得table数据的时候获取不到值,原因是仅仅改变了列的表现,没有改变列的值


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM