Providing data to the grid

Source: Internet
Author: User
Document directory
  • Row-Level Properties
  • Column-Level Properties
  • Order of checks
Providing data to the grid
  • Page history
Overview

The data is passed to the grid via the constructor and can also be accessed usingsetData(data)AndgetData()Methods. Data itself can be either an array-like object withlengthProperty 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

getItemMetadataProvides a powerful way of specifying additional information about a data item that let the grid customize the appearance and handling of a participant data item. The method shocould returnnullIf 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 shoshould 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 ults.
Examples

See colspan example.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.