Datagrid
Cell
- Instance Methods
- getDatumProps
Datagrid
- Instance Methods
- exportToCsv
HeaderCell
Datagrid
module.exports = class Cell extends React.Component
Cell
Cell is the controlled component rendered by default in each cell.
Cell propTypes:
12345678910111213141516171819202122232425 # is this cell selectedselected: PropTypes.bool# is this cell currently being editedediting: PropTypes.bool# is this cell able to be editededitable: PropTypes.bool# backbone model or object rowData: PropTypes.object# row index of row being renderedrowIndex: PropTypes.number# column defition objectcolumn: PropTypes.object# The collection the datagrid is renderingcollection: PropTypes.oneOfType([ PropTypes.object PropTypes.array]) # this component and the underlying Datum are controlled components# the value of the cell will not update until the value prop is passed invalue: PropTypes.anyonChange: PropTypes.func# called when user clicks edit icononEdit: PropTypes.func# default styles to apply to celldefaultCellStyle: PropTypes.object
Cell Instance Methods:
getDatumProps(value)
You can override or extend this method to change the props passed to the datum at runtime
module.exports = class Datagrid extends React.Component
Datagrid
This is react-datum-datagrid. Example: TODO
Datagrid propTypes:
123456789101112131415161718192021222324252627282930313233343536373839404142 # This should be an instance of a backbone collection or an array of javascript objects. # It can also be set through @context.collection or via Datagrid.setCollection() below.collection: PropTypes.oneOfType([ PropTypes.object PropTypes.array]) # the columns are compatible with the prop of the same name passed to App.views.widgets.react.Datagrid# see Class comment above for which column def attributes are usedcolumns: PropTypes.array# orientation of columns and rows can be flipped by setting this prop to 'portrait'orientation: PropTypes.oneOf(['landscape', 'portrait'])# set to true to ignore column definition `editable` and make all cells readonlyreadOnly: PropTypes.bool# width of the "headers" (labels) when orientation == 'portrait' headerWidth: PropTypes.number# height of the "headers" (labels) when orientation == 'portrait' headerHeight: PropTypes.number# default column definition attributesdefaultColumnDef: PropTypes.object# default component to render in data cells. default: ReactDatumDatagrid.CelldefaultCellComponent: PropTypes.any# default component to render in header cell. default: ReactDatumDatagrid.HeaderCelldefaultHeaderComponent: PropTypes.any# disables ctrl-Z to undo disableUndo: PropTypes.bool# the index of the sorted column (if one is sorted)sortColumnIndex: PropTypes.number# the direction the sortColumnIndex column is sortedsortDirection: PropTypes.oneOf(["ASC", "DESC"])# callback to call when cell selections changeonSelectedCellsChange: PropTypes.func# If provided, this callback method is called to sort the underlying collection# when the user clicks the sort icon in the header. ## If provided, you ** MUST ** also provide `sortColumnIndex` and `sortColumnDirection`# # If not, provided, rdd will assume the collection is fully fetched will sort the collection# internally. # # Called with (columnIndex, columnDef, direction, onComplete)# you ** must call the onComplete ** method passed when sorting is completeonSort: PropTypes.func
Datagrid defaultProps:
12345678 headerWidth: 150headerHeight: 60orientation: 'landscape'defaultHeaderComponent: HeaderCelldefaultCellComponent: CelldefaultColumnDef: { width: 120}
Datagrid Instance Methods:
exportToCsv()
Call this method to get a csv text representation of the grid
module.exports = class HeaderCell extends React.Component
HeaderCell
HeaderCell is a controlled component
HeaderCell propTypes:
1234567891011121314151617181920212223 # the column definitioncolumn: PropTypes.object# the index of the columncolumnIndex: PropTypes.number# the collection the datagrid is rendered from collection: PropTypes.oneOfType([ PropTypes.object PropTypes.array]) style: PropTypes.objectisSorting: PropTypes.boolisSelecting: PropTypes.boolsorted: PropTypes.oneOf(['ASC', 'DESC'])# callback method called when user clicks sort indicator. Called with (evt, columnIndex)onSort: PropTypes.func# callback method called when user clicks column name called with (evt, columnIndex)onSelectColumn: PropTypes.func# orientation of the data rows orientation: PropTypes.oneOf(['portrait', 'landscape'])# width of header when orientation is portrait and columnDef.width is ignoredwidth: PropTypes.number# height of header when orientation is landscape and columnDef.height is ignoredheight: PropTypes.number
A datagrid based on react-virtualized that works with or without Backbone.js and ReactDatum