Git Product home page Git Product logo

react-data-grid's Introduction

react-data-grid

npm-badge type-badge size-badge codecov-badge ci-badge

Features

Links

Install

npm install react-data-grid

react-data-grid is published as ECMAScript modules for evergreen browsers / bundlers, and CommonJS for server-side rendering / Jest.

Quick start

import 'react-data-grid/lib/styles.css';

import DataGrid from 'react-data-grid';

const columns = [
  { key: 'id', name: 'ID' },
  { key: 'title', name: 'Title' }
];

const rows = [
  { id: 0, title: 'Example' },
  { id: 1, title: 'Demo' }
];

function App() {
  return <DataGrid columns={columns} rows={rows} />;
}

API

Components

<DataGrid />

Props
columns: readonly Column<R, SR>[]

See Column.

An array describing the grid's columns.

⚠️ Passing a new columns array will trigger a re-render for the whole grid, avoid changing it as much as possible for optimal performance.

rows: readonly R[]

An array of rows, the rows data can be of any type.

topSummaryRows?: Maybe<readonly SR[]>
bottomSummaryRows?: Maybe<readonly SR[]>

An optional array of summary rows, usually used to display total values for example.

rowKeyGetter?: Maybe<(row: R) => K>

A function returning a unique key/identifier per row. rowKeyGetter is required for row selection to work.

import DataGrid from 'react-data-grid';

interface Row {
  id: number;
  name: string;
}

function rowKeyGetter(row: Row) {
  return row.id;
}

function MyGrid() {
  return <DataGrid columns={columns} rows={rows} rowKeyGetter={rowKeyGetter} />;
}

💡 While optional, setting this prop is recommended for optimal performance as the returned value is used to set the key prop on the row elements.

onRowsChange?: Maybe<(rows: R[], data: RowsChangeData<R, SR>) => void>

A function receiving row updates. The first parameter is a new rows array with both the updated rows and the other untouched rows. The second parameter is an object with an indexes array highlighting which rows have changed by their index, and the column where the change happened.

import { useState } from 'react';
import DataGrid from 'react-data-grid';

function MyGrid() {
  const [rows, setRows] = useState(initialRows);

  return <DataGrid columns={columns} rows={rows} onRowsChange={setRows} />;
}
rowHeight?: Maybe<number | ((row: R) => number)>

Default: 35 pixels

Either a number defining the height of row in pixels, or a function returning dynamic row heights.

headerRowHeight?: Maybe<number>

Default: 35 pixels

A number defining the height of the header row.

summaryRowHeight?: Maybe<number>

Default: 35 pixels

A number defining the height of summary rows.

selectedRows?: Maybe<ReadonlySet<K>>
onSelectedRowsChange?: Maybe<(selectedRows: Set<K>) => void>
sortColumns?: Maybe<readonly SortColumn[]>
onSortColumnsChange?: Maybe<(sortColumns: SortColumn[]) => void>
defaultColumnOptions?: Maybe<DefaultColumnOptions<R, SR>>
groupBy?: Maybe<readonly string[]>
rowGrouper?: Maybe<(rows: readonly R[], columnKey: string) => Record<string, readonly R[]>>
expandedGroupIds?: Maybe<ReadonlySet<unknown>>
onExpandedGroupIdsChange?: Maybe<(expandedGroupIds: Set<unknown>) => void>
onFill?: Maybe<(event: FillEvent<R>) => R>
onCopy?: Maybe<(event: CopyEvent<R>) => void>
onPaste?: Maybe<(event: PasteEvent<R>) => R>
onCellClick?: Maybe<(args: CellClickArgs<R, SR>, event: CellMouseEvent) => void>
onCellDoubleClick?: Maybe<(args: CellClickArgs<R, SR>, event: CellMouseEvent) => void>
onCellContextMenu?: Maybe<(args: CellClickArgs<R, SR>, event: CellMouseEvent) => void>
onCellKeyDown?: Maybe<(args: CellKeyDownArgs<R, SR>, event: CellKeyboardEvent) => void>
onSelectedCellChange?: Maybe<(args: CellSelectArgs<R, SR>) => void>;

Triggered when the selected cell is changed.

Arguments:

  • args.rowIdx: number - row index
  • args.row: R - row object of the currently selected cell
  • args.column: CalculatedColumn<TRow, TSummaryRow> - column object of the currently selected cell
onScroll?: Maybe<(event: React.UIEvent<HTMLDivElement>) => void>
onColumnResize?: Maybe<(idx: number, width: number) => void>
enableVirtualization?: Maybe<boolean>
renderers?: Maybe<Renderers<R, SR>>

This prop can be used to override the internal renderers. The prop accepts an object of type

interface Renderers<TRow, TSummaryRow> {
  renderCheckbox?: Maybe<(props: RenderCheckboxProps) => ReactNode>;
  renderRow?: Maybe<(key: Key, props: RenderRowProps<TRow, TSummaryRow>) => ReactNode>;
  renderSortStatus?: Maybe<(props: RenderSortStatusProps) => ReactNode>;
  noRowsFallback?: Maybe<ReactNode>;
}

For example, the default <Row /> component can be wrapped via the renderRow prop to add context providers or tweak props

import DataGrid, { RenderRowProps, Row } from 'react-data-grid';

function myRowRenderer(key: React.Key, props: RenderRowProps<Row>) {
  return (
    <MyContext.Provider key={key} value={123}>
      <Row {...props} />
    </MyContext.Provider>
  );
}

function MyGrid() {
  return <DataGrid columns={columns} rows={rows} renderers={{ renderRow: myRowRenderer }} />;
}

⚠️ To prevent all rows from being unmounted on re-renders, make sure to pass a static or memoized component to renderRow.

rowClass?: Maybe<(row: R) => Maybe<string>>
direction?: Maybe<'ltr' | 'rtl'>

This property sets the text direction of the grid, it defaults to 'ltr' (left-to-right). Setting direction to 'rtl' has the following effects:

  • Columns flow from right to left
  • Frozen columns are pinned on the right
  • Column resize handle is shown on the left edge of the column
  • Scrollbar is moved to the left
className?: string | undefined
style?: CSSProperties | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined
'aria-describedby'?: string | undefined
'data-testid'?: Maybe<string>

<TextEditor />

Props

See RenderEditCellProps

<Row />

See renderers

Props

See RenderRowProps

The ref prop is supported.

<SortableHeaderCell />

Props
onSort: (ctrlClick: boolean) => void
sortDirection: SortDirection | undefined
priority: number | undefined
tabIndex: number
children: React.ReactNode

<ValueFormatter />

Props

See FormatterProps

<SelectCellFormatter />

Props
value: boolean
tabIndex: number
disabled?: boolean | undefined
onChange: (value: boolean, isShiftClick: boolean) => void
onClick?: MouseEventHandler<T> | undefined
'aria-label'?: string | undefined
'aria-labelledby'?: string | undefined

<ToggleGroupFormatter />

Props

See RenderGroupCellProps

Hooks

useRowSelection<R>(): [boolean, (selectRowEvent: SelectRowEvent<R>) => void]

Other

SelectColumn: Column<any, any>

SELECT_COLUMN_KEY = 'select-row'

Types

Column

DataGridHandle

RenderEditCellProps

RenderCellProps

RenderGroupCellProps

RenderRowProps

Generics

  • R, TRow: Row type
  • SR, TSummaryRow: Summary row type
  • K: Row key type

react-data-grid's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-data-grid's Issues

webpack -w report error in windows

I use the version: "0.13.0-alpha1" and webpack
it report the error:

ERROR in ./~/react-data-grid/dist/react-data-grid-with-addons.js
Module parse failed: \node_modules\react-data-grid\dist\react-data-grid-with-addons.js Line 4078: Duplicate data property in object literal not al
lowed in strict mode
You may need an appropriate loader to handle this file type.
|             return React.createElement('span', { className: 'glyphicon glyphicon-remove form-control-feedback' });
|           }

I check the code in dist/react-data-grid-with-addons.js
these two function duplicate:
render()
renderStatusIcon()
then I remove it, and webpack ok
something wrong?

Throws an error when Immutable is not a global variable.

I copied the full featured example, but it throws

Uncaught TypeError: Cannot read property 'setScrollLeft' of undefined

since the getSize method checks the global Immutable object:

  getSize: function getSize(columns) {
    if (Array.isArray(columns)) {
      return columns.length;
    } else if (typeof Immutable !== 'undefined') {
      return columns.size;
    }
  }

I'm using CommonJS & webpack so the Immutable is not exposed, so that method returns undefined.
I think for non-array objects, it might be better to directly return the size property or length for other array-like objects.

[Idea] Custom Header Menu with hide column ability

image

Description:

Create new functionality in React Data Grid that allows the user to hide a given column by clicking on a drop down menu item of that columns header cell.

Requirements:

  • Modify the file https://github.com/adazzle/react-data-grid/blob/master/src/HeaderCell.js such that it renders a drop down menu as in the screenshot above that enables the user to hide a given column when the option is clicked.
  • When the menu item is clicked, an onHideColumn event should be triggered in React Data Grid that should set the modify the state of ReactDataGrid component in https://github.com/adazzle/react-data-grid/blob/master/src/addons/grids/ReactDataGrid.js to toggle an isVisible property of state.columnMetrics.columns

eg, if the second column is hidden, then set this.state.columnMetrics.columns[1].isVisible = false

Bonus points:

Write one or more tests in https://github.com/adazzle/react-data-grid/blob/master/src/__tests__/HeaderCell.spec.js demonstrating this new functionality.

Any questions, PM me on the react data grid slack channel.

hidden colums

setting column.hidden should not render that column

Register package with bower

It doesn't seem registered at the moment:

bower install --save react-data-grid
bower                        ENOTFOUND Package react-data-grid not found

Installing with bower install adazzle/react-data-grid --save also does not work, the src files are ignored.

Latest npm release (0.13.1-flow-osx673) downloads code outside of NPM.

npm install --save react-data-grid on a fresh project currently pulls in version 0.13.1-flow-osx673.

https://www.npmjs.com/package/react-data-grid See sidebar: '0.13.1-flow-osx673 is the latest of 42 releases'.

First I wonder if that's intentional... people trying out this library for the first time using the normal npm install are getting a broken version. (I'll post another issue, but this build still has loads of issues running on React 0.13, and even includes a 'debugger' statement in HeaderCell.render().)

Getting to this specific issue... npm install downloads code directly from github for facebook/flow without going through NPM.

> [email protected] postinstall /Users/_hidden_/node_modules/react-data-grid/node_modules/gulp-flowtype/node_modules/flow-bin
> node lib/install.js

     fetch : https://github.com/facebook/flow/releases/download/v0.13.1/flow-osx-v0.13.1.zip
  progress : [====================] 100% 0.0s

  ✔ flow binary test passed successfully

I'm guessing this is by design and based on limitation of availability of flow, but I'm hoping this is a temporary change.

This will most likely prevent me from using react-data-grid inside my company because we need to control/archive/audit the code that is getting used in any given build. It's fine for my POC and development work, but if I push a project with react-data-grid as a dependency and it runs on our production build servers, and it's pulling in random code from the internet at that time, the build will get blocked. (Dependencies pulled via NPM can be easily archived and audited on our internal NPM/Nexus repo).

If I may... I encourage you to stick with npm-only downloads in the build process.

Is this install.js-based dependency going to stick around?

-Thanks

Accessing selected rows in react 0.13

Can anyone help me figure out how to access the selected rows? I need to take the selected rows and add them to another table then assign those records to a parent.

I looked in the tests and saw they're accessed via the component's state (component.state.selectedRows).

How would I do that from the context where I render my ReactDataGrid (my render function)? I thought I could use a ref but ref is not working because of cloneWithProps being used in ReactDataGrid, which drops refs. Any plans to update cloneWithProps calls to the new cloneElement any time soon? https://facebook.github.io/react/blog/2015/03/03/react-v0.13-rc2.html

Immutable.js dependency

This project relies on Immutable being globally available. Are there any plans on adding it as a dependency so you don't have to attach Immutable to window or global? Specifically these checks are causing problems:

typeof Immutable !== 'undefined'

Thanks!

export to excel or pdf?

is there currently a feature to export to excel or pdf? if not, can you give me some pointers as to which are the best practices for implementing such a feature? i'd like to contribute by incorporating those features in to this project.

Allow editors or formatters to request additional props from row through prop types

Sometimes a cell editor needs access to additional cell values. Proposing a way for an editor to request these extra values through prop types such that if the prop name exists on the row then it will be passed to the editor from the editor container

var nameEditor = React.createClass({

  propTypes : {
     firstName: React.PropTypes.string.isRequired,
     lastName: React.PropTypes.string.isRequired
  }

if firstName and lastName are properties on the row then they will be passed to the editor from the editor container

how to display a bootstrap dropdown button in a cell ?

Firstly: react-data-grid looks great !

I'm trying to render a bootstrap dropdown button (using react-bootstrap) in a cell. The button renders ok, but the dropdown menu doesn't display though. I guess my css foo isn't up to scratch. Any ideas on how I can bring the dropdown menu to display ?

cheers
Magnus

Enter key does not advance to next row

Thanks for the great work on this component. This is the best editable spreadsheet-like component I've seen so far.

In most spreadsheets (Excel/google spreadsheets), the cells are all editable. Tabbing moves between them, and [Enter] moves to the next row.

In react-data-grid, Enter seems to always toggle cell editing on/off, which feels awkward from a bulk data-entry perspective. Is there some way to have the cells be editable, and [Enter] does the expected thing of moving to the next row?

[Idea] Display number of visisble rows count in toolbar

image

Difficulty: Easy

Description:

The toolbar should display an indication showing the number of visible rows as well as the total rows count as in the image above.

Requirements

The ReactDataGrid component needs to know when the Viewport is scrolled. It can then update the toolbar with the indexes of the visible rows.

bug when grid placed inside bootstrap tab or modal

Hi,
I am using ‘react-data-grid’ component in my application, but when component is rendered at first time it won’t get display on window and when I open developer tool bar then component is working fine.
Please let us know your opinion on the same.
render:function(i)
{
var rowGetter = function(i){
return _rows[i];
};
return(
My component tag is as below.

);
}

Thanks in advance.
Regards,
Shekhar

Add classNames in columns

I dont know if this is possible right now but according to documentation there is still no way how I could add classNames or styles by columns.

Currently what I could do is to create a custom formatter, however it will be much more easy if we could add classNames upon declaration.

In example:

//Columns definition
var columns = [
{
  key: 'id',
  name: 'ID',
  locked : true,
  classNames: 'center'
},
{
  key: 'task',
  name: 'Title',
  width: 200
}

Strange behavior on changing screen size

When placing a ReactDataGrid element into a div, resizing the screen area (by minimizing then maximizing, or for instance by popping up developers tools and resizing that) the rendered area of the ReactDataGrid will constantly grow horizontally, each time the rendering window size changes.

I have reproduced this behavior using the code from the "Basic Example" provided on the RDG examples page. The behavior presents on both Chrome and Firefox.

Attached is an html file (saved as .txt so I could upload it) called "sizing_test" containing the webpage I used to reproduce the bug. I'm still thinking of a way to create a failing test for this kind of thing, but decided to create the issue with the info I have.

sizing_test.txt

Editors not rendering

var states = ['pending', 'whitelisting', 'completed'];
var DropDownEditor = ReactDataGrid.Editors.DropDownEditor;
var StatesEditor = < DropDownEditor, options={states} />;

var priorities = [{id:0, title : 'Critical'}, {id:1, title : 'High'}, {id:2, title : 'Medium'}, {id:3, title : 'Low'}]
var AutoCompleteEditor = ReactDataGrid.Editors.AutoComplete;
var PrioritiesEditor = < AutoCompleteEditor, options={priorities} />;

Warning: Failed propType: Required prop value was not specified in EditorContainer. Check the render method of Cell.
warning.js:48 Warning: Failed propType: Required prop commit was not specified in SimpleTextEditor. Check the render method of EditorContainer.

Duplicated functions in dist/react-data-grid.js

My webpack build includes a preLoader run through JSCS. It errors out on react-data-grid.js because render() and renderStatusIcon() functions both appear twice in the EditorContainer component (around line 4080). They appear to be identical, so probably no harm other than having lint checkers barf.

Double Event triggered on Editing Cells

I'm attempting to use the grid as an interactive view into a database, allowing the user to edit/add entries by directly editing cells in the grid. However, I'm getting some strange behaviour apparently dependent on the key that is used to complete the edit:

Simply clicking away from the cell works fine.
Pressing 'Enter' fires two copies of the update event (this is an issue due to the asynchronicity making catching "repeat" events almost impossible)
Pressing 'Tab' fires two events AND fails to re-render the grid/cell (refocusing makes it show the correct info)
Using the arrow keys presents the same issues as the 'Tab' key.

Is there some particular part of the grid definition I might be doing wrong that could cause these errors? Or is there any other advice/help to offer?

I can't seem to attach a .txt of the code file ("something went really wrong"...), so here is the part defining the grid:

var DataGrid = React.createClass({

getInitialState: function()
{
console.log("Getting initial state");
var rows = getRows();
//setGrid(this);
return {rows : rows};
},

rowGetter: function(rowIdx)
{
return this.state.rows[rowIdx];
},

handleRowUpdated: function(e)
{
if(this.state.rows[e.rowIdx][e.cellKey] != e.updated[e.cellKey]/* && e.key == 'Enter'*/)
{//table doesn't seem to update properly (though using forceUpdate below...) if the user
//uses a key other than "Enter". Using Tab or the arrow keys doesn't do it.
//The database updates, but the shown data doesn't change - refocusing on the element
//changes it. For now, restricting to the "Enter" key.
console.log(JSON.stringify("Last Event is: " + this.state.lastEvent));
console.log(JSON.stringify(e));
console.log(JSON.stringify(e) == JSON.stringify(this.state.lastEvent));
this.setState({lastEvent: e});
var boxNumber = this.state.rows[e.rowIdx]['box_num'];
var key = e.cellKey;
var data = e.updated[e.cellKey];
var sendString = '{"key":"' + key + '", "data":"' + data + '"}';
e.boxNumber = boxNumber;
console.log("Sending: " + sendString);
jQuery.ajax({
url: ("/CollectionBox/edit/" + boxNumber),
type: 'POST',
dataType: 'text',
data: sendString,
success: function(rMessage)
{
changeNotice(rMessage);

      if(rMessage[0] == 'S') //"[S]uccess"
      {  
          var event = dataGrid.state.lastEvent;
          var boxNum = event.boxNumber;
          var key = event.cellKey;
          changeRow = _rows.filter(function ( obj ) { return obj.box_num == boxNum })[0];
          //console.log("We will be changing this row: " + JSON.stringify(changeRow));
          //console.log(key + ":" + changeRow[key] + " will become " + key + ":" + event.updated[key]);
          dataGrid.state.rows[event.rowIdx][event.cellKey] = event.updated[event.cellKey];
          dataGrid.forceUpdate(); //would like to replace forceUpdate
      }
      console.log(rMessage);
      }
  });
  }

},

handleGridSort: function(sortColumn, sortDirection)
{
var comparer = function(a, b)
{
if(sortDirection === 'ASC')
return (a[sortColumn] > b[sortColumn]) ? 1 : -1;
else if (sortDirection === 'DESC')
return (a[sortColumn] < b[sortColumn]) ? 1 : -1;
}
var rows = sortDirection === 'NONE' ? this.state.rows.slice(0) : this.state.rows.sort(comparer);
this.setState({rows : rows});
//renderGrid();
},

render: function() {
return ();
}
});

[Idea] Drag column to reorder

Description

Implement column header dragging to reorder a column

Requirements

Document how to pass row data into formatter

I had a case where I needed to access others row values inside a cell formatter. Maybe be worth documenting it ?

This is how I achieved it.

let columns = [
    ...
    {
        key: 'mykey',
        name: 'My Column',
        formatter: Formatters.myFormatter,
        getRowMetaData: (row) => row
    }
    ...
];

In into my formatter I can access all the row values into this.props.dependentValues

[Idea] Enable Cell Expand functionality

Enable Cell Expand functionality

Description

Currently, when text the text of a cell in React Data Grid becomes too long, it gets truncated and an elipsis is shown. We would like a method to display the full amount of text in a cell if the text is too long.
This could be from either exapanding the height and width of the cell to show the entire content. Or displaying that content in a modal.

Current functionality

image

Desired functionality

image

Requirements:

Bonus Points:
Add one of more tests in https://github.com/adazzle/react-data-grid/blob/master/src/Cell.js or on your new component to verify the new functionality

copy value ranges

i'd like to be able copy & paste a range of rows and columns, similar to what you can do in Excel at the moment.

this could be copying between cell ranges on the same grid, between two separate grid instances, or from somewhere off-grid (e.g. Excel).

excel copy paste

Does not render

My datagrid does not render, with error:
screen shot 2015-09-07 at 17 51 58

Code:

                    <ReactDataGrid
                        columns={[
                            {'key': 'rating', 'name': 'Rating', 'formatter': PercentageFormatter},
                            {'key': 'name', 'name': 'Name', 'editable': true, 'width': 400},
                            {'key': 'count_songs', 'name': '# Songs', 'width': 100}
                        ]}
                        rowGetter={this.rowGetter}
                        rowsCount={this.state.lib_albums.length}
                        enableCellSelect={true}
                        onRowUpdated={this.onRowUpdated} />

Last column's idx is off when enableRowSelect is true

When you set enableRowSelect to true a select column is prepended to the the columns stored in state. However the columns that are stored in props remain the same.

Having the props columns being different than the state columns causes the idx to be off by one. This makes getting the last column return undefined for this line.

var col = this.getColumn(this.props.columns, idx);

This issue can also be found on the examples page. If try to edit the furthest right column you can see an exception thrown in the console. http://adazzle.github.io/react-data-grid/examples.html#/all-features-immutable.

Ignore this issue

Sorry I opened an issue on the wrong repo. Unfortunately I cannot remove it.

Allow for more functional design (rather than OO)

Not sure whether this would be an enhancement you would consider but it might be beneficial to use a little bit more of functions and attributes rather then objects and properties.
I am just evaluating this together with facebook's fixed-data-table - and fb's table (while having less features than react-data-grid) works perfectly in this regards, it just requires functions where a function is needed (cell renders aka formatters, cell data getters etc.) and expects necessary data to be passed as such function's arguments (which makes such function's use quite self-explanatory).
React-data-grid on the other hand (while having much more features) seems to expect everything to be an object that has functions (with no attributes) that are supposed to access object's properties that were somehow (miraculously) set before.
I am trying to use react-data-grid from a functional language (clojurescript) and pretty much I just have to resort to writing js code quite often whereas with fixed-data-table there are no issues.
Apologies if I misunderstood the concept (I am new to react-data-grid) or am missing something. Basically what I am trying to understand is follows - what are the benefits of using this design:

//Custom Formatter component
var PercentCompleteFormatter = React.createClass({
  render:function(){
    var percentComplete = this.props.value + '%';
    return (
      <div className="progress" style={{marginTop:'20px'}}>
        <div className="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{width:percentComplete}}>
        {percentComplete}
      </div>
      </div>);
    }
  });

as opposed to this design (e.g. used by fixed-data-table):
The cell renderer that returns React-renderable content for table cell.
cellRenderer

function(
  cellData: any,
  cellDataKey: string,
  rowData: object,
  rowIndex: number,
  columnData: any,
  width: number
): ?$jsx

type: func

Implement Grouping

Grouping is a key feature for the grid, and fills a lot of use cases for us. It is also several things to different people. We see this as:

Grouping

Choose a field (or fields) to group on, and then show the grid with expand and collapse based on this.
Further enhancements include allowing a way to also specify metrics, so that we can display summary info, whether thats number of records, or avg/sum/min/max

Key issues

  • Means that the Grid needs to have a view of the entire data set, so this will need to be partly done inside ReactDataGrid, and partly in a data view adapter in front of the rowGetter
  • Makes sorting and filtering more complex

Child rows

Using the same headers, but having expand and collapse on child items

Key Considerations

  • How would we express this in the row data. Should it be a different prop, getter, or just a simple convention (ie if(row.children) { .. })?
  • Shouldnt affect sort / filter. Though filter on children might be nice to have?
  • Should this be n-dimension? using row.children should in theory be easy enough
  • Will mean some state to track expand / collapse, and fundamental changes to equations on grid metrics (esp hieght)
  • Need to consider how this works alongside frozen cols

Sub Grids

Having the ability to have master / detail tables, where the subgrid is entirely independent in structure (ie it has different headers, formatters, etc)
In theory this is an extension of child rows, but rather than row.children we have row.subGrids or similar

Key considerations

  • Should be an extension of child rows, and so have the same considerations
  • Need to ensure we stay performant
  • do we keep the same convention (ie row.children) and then just sniff if these are rows, or a grid? Or be explicit (row.children vs row.subGrids)

Bring code coverage > 90%

Currently, coverage reports are only being generated for files that have been required in tests. This gives a misleading representation for the amount of code actually covered. Need to require all files in solution in test/index.jsx and then work on increasing the code coverage to a reliable level

Updating grid data with a new row causes it to jump to the bottom and select

There are two places with logic to deal with a new row:

However, this means that modifying the grid data using an external menu (eg. show / hide rows), or updating the grid data periodically can trigger this behaviour.

Is there another way to tag that row has been specifically added, rather than just a change in the row count?

Cell Highlighting Improvements

Cell highlight class should be applied on render not manually to the dom on componentDidUpdate

Also, need to ensure that highlighting can be applied multiple times to the same cell. Currently when a cell has been updated, and the highlight class is applied, subsequent updates to the same cell will have no affect.

[Idea] Empty Rows Placeholder

Description

Currently if an empty array of rows are provided to the grid, the grid will display an empty viewport. It should be possible to pass an EmptyRowView as props to ReactDataGrid that gets rendered if an empty array of rows is passed to ReactDataGrid

Current Design

image

Requirements

Bonus points

Write a test to show the new funcionality

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.