bootstraptable設置列默認值


示例:見代碼一,通過formatter可以控制顯示字段的值,假設渲染bootstraptable時該值未被渲染,同時頁面提交時該值也未被修改,在后台該值為null,而不是formatter中設置的'',要想達到設置默認值效果,需要加上row.name = ''; 見代碼二。

代碼一:

{
    title: "中文名稱",
    field: "name",
    width: "80",
    editable: {
    type: 'text'
    },
    formatter: function (value, row, index) {
      if (value)
          return value;
      else
          return '';
    }
}

 

代碼二:

{
    title: "中文名稱",
    field: "name",
    width: "80",
    editable: {
    type: 'text'
    },
    formatter: function (value, row, index) {
      if (value) {
          return value;
      } else {
  row.name = '';  
      return '';
     } } }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM