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是行号
  • 相关阅读:
    Leetcode题目:Remove Duplicates from Sorted List
    Leetcode题目:Lowest Common Ancestor of a Binary Search Tree
    Leetcode题目:Ugly Number
    Leetcode题目:Remove Linked List Elements
    Leetcode题目:Count and Say
    6-3 事务
    6-1 视图
    5-2 pymysql模块
    5-1 图形工具Navicat
    4-3 多表查询
  • 原文地址:https://www.cnblogs.com/popping57/p/3311076.html
Copyright © 2011-2022 走看看