当前位置: 首页 > 软件库 > 程序开发 > >

ember-table

授权协议 View license
开发语言 JavaScript
所属分类 程序开发
软件类型 开源软件
地区 不详
投 递 者 夹谷茂
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Ember Table

An addon to support large data set and a number of features around table. Ember Table canhandle over 100,000 rows without any rendering or performance issues.

Ember Table 3.x supports:

  • Ember 2.8 to Ember 3.28 (last 3.x version of Ember).
  • Last two versions of Chrome, Safari, Edge, Firefox on desktop and mobile.

For older platforms, the final release of Ember Table 2.x (2.2.3) supports:

  • Ember 1.11-3.8+
  • IE11+

Install

ember install ember-table

Features

  • Column resizing, column reordering.
  • Table resizing.
  • Fixed first column.
  • Custom row and custom header.
  • Handles transient state at cell level.
  • Single, multiple row selection.
  • Table grouping.

Documentation

Documentation is available at: https://opensource.addepar.com/ember-table/docs

Ember Table uses ember-cli-addon-docs for its documentation.To run the docs locally, clone the repo, run yarn && yarn start and then navigate to http://localhost:4200/docs.

Usage

To use Ember Table, you need to create columns and rows dataset.

columns is an array of objects which has multiple fields to define behavior of the column.The objects can be simple POJOs, and there are no hard requirements about their shape.They may have a valuePath, and if they do this path will be used to get the value fromeach row for that column. If you only want to use the default template, you can alsospecify a name on the column which will be rendered in the template.

columns: [
  {
    name: `Open time`,
    valuePath: `open`,
  },
  {
    name: `Close time`,
    valuePath: `close`,
  },
];

rows could be a javascript array, ember array or any data structure that implements length andobjectAt(index). This flexibity gives application to avoid having all data at front but loads moredata as user scrolls. Each object in the rows data structure should contains all fields definedby all valuePath in columns array.

rows: computed(function() {
  const rows = emberA();

  rows.pushObject({
    open: '8AM',
    close: '8PM',
  });

  rows.pushObject({
    open: '11AM',
    close: '9PM',
  });

  return rows;
});

Template

The following template renders a simple table.

  {{#ember-table as |t|}}
    {{t.head columns=columns}}

    {{t.body rows=rows}}
  {{/ember-table}}

You can use the block form of the table to customize its template. The componentstructure matches that of actual HTML tables, and allows you to customize it atany level. At the cell level, you get access to these four values:

  • value - The value of the cell
  • cell - A unique cell cache. You can use this to track cell state withoutdirtying the underlying model.
  • column - The column itself.
  • row - The row itself.

You can use these values to customize cell in many ways. For instance, if youwant to have every cell in a particular column use a component, you can add acomponent field to your column (or feel free to use any other property nameyou like):

  {{#ember-table as |t|}}
    {{t.head columns=columns}}

    {{#t.body rows=rows as |b|}}
      {{#b.row as |r|}}
        {{#r.cell as |value column row|}}
          {{component column.component value=value}}
        {{/r.cell}}
      {{/b.row}}
    {{/t.body}}
  {{/ember-table}}

The rendered table is a plain table without any styling. You can define styling for your own table.If you want to use default table style, import the ember-table/default SASS file.

Optional Footer

You can also use the ember-tfoot component, which has the same API asember-tbody:

  {{#ember-table as |t|}}
    {{t.head columns=columns}}

    {{t.body rows=rows}}

    {{t.foot rows=footerRows}}
  {{/ember-table}}

Migrating from old Ember table

To support smooth migration from old version of Ember table (support only till ember 1.11), we havemove the old source code to separate package ember-table-legacy.It's a separate package from this Ember table package and you can install it using yarn or npm.This allows you to have 2 versions of ember table in your code base and you can start your migratingone table at at time. The recommended migration steps are as follows (if you are using ember 1.11):

  1. Rename all your ember-table import to ember-table-legacy. (for example:import EmberTable from 'ember-table/components/ember-table' becomesimport EmberTableLegacy from 'ember-table-legacy/components/ember-table-legacy'. Remove referenceof ember-table in package.json.
  2. Install ember-table-legacy using yarn add ember-table-legacy or npm install ember-table-legacy
  3. Run your app to make sure that it works without issue.
  4. Reinstall the latest version of this ember-table repo.
  5. You can start using new version of Ember table from now or replacing the old ones.

Notes for maintainers

Releasing new versions (for maintainers)

We use release-it.To create a new release, run yarn run release. To do a dry-run: yarn run release --dry-run.The tool will prompt you to select the new release version.

Generating documentation.

This library is documented using Ember Addon Docs. v0.6.3+ of that librarybring a CSS reset files into the test suite of Ember Table, meaning manytests would be corrupted away from the useragent styles they were writtenagainst.

Because of this, building the docs requires going through Ember Try. Forexample to run tests asserting the docs build:

ember try:one ember-default-docs

You might also want to run a command with the addon docs libraries installed,for example to create a production build, and you can do so like this:

ember try:one ember-default-docs --- ember build -e production
  •    EmberZnet3.1 存在以下3种广播方式:    1. EMBER_BROADCAST_ADDRESS(0xFFFC)        作用: 对ZC和ZR设备广播;        2. EMBER_RX_ON_WHEN_IDLE_BROADCAST_ADDRESS(0xFFFD)        作用:对于除了non-sleepy设备广播;       3. EMBER_SLEEPY_B

  •    在模版中写好响应操作触发的action之后,可以在controller:actions中设置了,需要注意的是对数据的操作一般都是对单个object进行操作,所以先要使用笔记1中的方法使用ObjectController。   新增并存储数据:       模版中可以设置 {{input type="text" class="form-control" placeholder="title"

  • Ember Polling       子节点与父节点通过polling机制确保彼此在网络状态,子节点通过定期发送Data request来确保自己在线。而父节点则通过获取data request维护child table,否则,如果子节点意外离网又没有通知父节点,则子节点路由长期占有child table,影响其他设备加入网络。   ZED:       通过宏定义       EMBER_AF

  • 怎样取嵌在iframe里的报表单元格的值 页面引入finereport.js,用以调用jquery方法 取到iframe中报表的content-container:var $container = $("div.content-container",$("#report")[0].contentWindow.document) 取到报表单元格:var text = $("tr[tridx=2]",

  • 在已经设置route的情况下,以table为例,可以如下设置,范围为对应的模版; App.TableView = Em.View.extend({ }); App.TableIndexView = Em.View.extend({ }); 也可以通过如下新建,其获得的this为所在模版的this; {{#view InnerView}}......{{/view}} InnerView = E

 相关资料
  • Ember检查器是一个浏览器插件,用于调试Ember应用程序。 灰烬检查员包括以下主题 - S.No. 灰烬检查员方式和描述 1 安装Inspector 您可以安装Ember检查器来调试您的应用程序。 2 Object Inspector Ember检查器允许与Ember对象进行交互。 3 The View Tree 视图树提供应用程序的当前状态。 4 检查路由,数据选项卡和库信息 您可以看到检查

  • 英文原文: http://emberjs.com/guides/getting-ember/index/ Ember构建 Ember的发布管理团队针对Ember和Ember Data维护了不同的发布方法。 频道 最新的Ember和Ember Data的 Release,Beta 和 Canary 构建可以在这里找到。每一个频道都提供了一个开发版、最小化版和生产版。更多关于不同频道的信息可以查看博客

  • Yeti Table Yeti Table provides a new expressive way to build tables in Ember with flexibility in mind. Installation ember install ember-yeti-table Why Yeti Table? Perhaps the biggest difference compar

  • Ember Light Table is a lightweight contextual component based table addon that follows Ember's actions up, data down ideology. WARNING The API for initializing Ember Light Table (v2.x) has recently ch

  • Ember-models-table Install ember install ember-models-table Discussion Join the official Ember Discord server. Usage Major version 3.x is latest version of ember-models-table. Demo for ember-bootstrap

  • ember-emojione ember-emojione is your emoji solution for Ember, based on the EmojiOne project. EmojiOne version 2 is used, which is free to use for everyone (CC BY-SA 4.0), you're only required to giv