zoukankan      html  css  js  c++  java
  • easyui datagrid formatter

    如何在datagrid 的field单元格中加入一个链接,如何根据内容来替换单元格的内容?

    这些功能都可以通过datagrid的formatter实现,比如如果要在一个单元格中加入一个链接,可以这样写

       1:  {
       2:    field: "xx",
       3:    formatter: function(value,row,index) {
       4:      return "<a href="#">test</a>"
       5:    }
       6:  }
    如果想根据value的值不同来变换单元格内容,可以这样写
       1:  {
       2:    field: "test",
       3:    formatter: function(value,row,index) {
       4:      if (value == 1) {
       5:        return "right"
       6:      }else{
       7:        return "wrong"
       8:      }
       9:    }
      10:  }
    其中value就是当前单元格的内容,row是整行的数据,index是行号
  • 相关阅读:
    python面试题
    面试总结
    552 Student Attendance Record II 学生出勤记录 II
    551 Student Attendance Record I 学生出勤纪录 I
    547 Friend Circles 朋友圈
    546 Remove Boxes 移除盒子
    543 Diameter of Binary Tree 二叉树的直径
    542 01 Matrix 01 矩阵
    3.1 特性
    2.6 datetime 模块
  • 原文地址:https://www.cnblogs.com/popping57/p/3311076.html
Copyright © 2011-2022 走看看