SlickGrid what is a Data View?

前端 未结 3 2069
遥遥无期
遥遥无期 2021-02-01 20:49

I started to use SlickGrid and I got confused about the difference between Data View and Grid (with editing enabled). I haven\'t found in the docs some discussion about data vie

3条回答
  •  长情又很酷
    2021-02-01 21:37

    DataView is an abstraction on top of your data source. If all of the data is available on the client (i.e. in a Javascript array), DataView can provide many useful features that the grid itself doesn't have. (This fact that the grid lacks these features is by design - SlickGrid tries to keep the core lean and simple while encouraging modular design and data abstraction in its API.)

    DataView works by taking in your data and acting as a data provider that you can pass to SlickGrid instead of your original data array. For example, if you make DataView group data, it makes the grid think that the "group" rows are just regular data items, so the grid doesn't need to be aware of them. DataView tells the grid that those items have a custom display and behavior and provides implementations of both. You then wire up DataView's onRowCountChanged and onRowsChanged events to update the grid and voila.

    Here's a rough list of features that DataView adds to the grid:

    • Paging.
    • Sorting.
    • Search.
    • Grouping with totals.
    • Expand/collapse groups.

提交回复
热议问题