• Providing data to the grid


    Overview

    The data is passed to the grid via the constructor and can also be accessed using the setData(data) and getData() methods. Data itself can be either an array-like object with a length property and an indexer (data[index]) or a custom data provider implementing the following interface:

    • getLength() - returns the number of data items in the set
    • getItem(index) - returns the item at a given index
    • getItemMetadata(index) - returns the metadata for the item at a given index (optional)

    Item Metadata

    getItemMetadata provides a powerful way of specifying additional information about a data item that let the grid customize the appearance and handling of a particular data item. The method should return null if the item requires no special handling, or an object in the following general format:

    {
      // properties describing metadata related to the item (i.e. grid row) itself
      "<property>": value,
      "<property>": value,
    
      // properties describing metadata related to individual columns
      "columns":  {
        "<column index>":  {
          // metadata indexed by column index
          "<property>": value,
          "<property>": value
        },
    
        "<column id>":  {
          // metadata indexed by column id
          "<property>": value,
          "<property>": value
        }
      }
    }
    

    Row-level properties

    • cssClasses (string) - One or more (space-separated) CSS classes to be added to the entire row.
    • focusable (boolean) - Whether or not any cells in the row can be set as "active".
    • selectable (boolean) - Whether or not a row or any cells in it can be selected.

    Column-level properties

    • focusable (boolean) - Whether or not a cell can be set as "active".
    • selectable (boolean) - Whether or not a cell can be selected.
    • formatter (Function) - A custom cell formatter.
    • editor (Function) - A custom cell editor.
    • colspan (number|string) - Number of columns this cell will span. Can also contain "*" to indicate that the cell should span the rest of the row.

    Order of checks

    When looking up a property, the grid checks in the following order:

    1. Row-level item metadata.
    2. Column-level item metadata by column id.
    3. Column-level item metadata by column index.
    4. Column definition.
    5. Grid options.
    6. Grid defaults.

    Examples

    See colspan example.

  • 相关阅读:
    迅为4412开发板一键烧写QT程序到开发板
    迅为-i.IMX6Q开发板QT系统移植wifi-mt6620(一)
    迅为3399开发板人工智能测试-对象检测
    迅为IMX6ULL开发板搭建 Web 服务器
    迅为IMX6开发板AndroidStudio-ledtest小灯_测试
    迅为3399开发板Android7/Android8修改开机动画
    layui
    MyBatis
    开发过程,一个完整的开发过程需要完成哪些工作?分别由哪些不同的角色来完成这些工作?
    做好测试计划工作的关键是什么?
  • 原文地址:https://www.cnblogs.com/zfc2201/p/2493558.html
Copyright © 2020-2023  润新知