facebookarchive / fixed-data-table

A React table component designed to allow presenting thousands of rows of data.
http://facebook.github.io/fixed-data-table/
Other
4.3k stars 553 forks source link

More permissive propType for dataKey/cellDataKey #181

Open andreypopp opened 9 years ago

andreypopp commented 9 years ago

I'm using an array (key path inside nested data structure) as a dataKey for column but that generates a lot of warnings because it neither matches number nor string. Of course I can encode key path as string but I'd rather keep it as array not to parse it every time. What do you think of allowing arrays as dataKey/cellDataKey within the data table?

ehzhang commented 9 years ago

In the case of a nested datastructure, I'm on more of the side of keeping it as Number or String since it seems to be more of a common convention to represent nested paths as strings.

MandarinConLaBarba commented 9 years ago

I might find this useful as well, currently doing things like this:

  /**
   * Get data for a 'data' cell
   *
   */
  _dataCellDataGetter(columnId, rowSpec) {

    let item = this._getRowItem(rowSpec);

    return item.getIn(['cells', columnId]);

  },
jdelafon commented 9 years ago

Keys should not be mutable objects, imho.