npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-datum-datagrid

v0.5.2

Published

A datagrid based on react-virtualized that works with or without Backbone.js and ReactDatum

Downloads

57

Readme

react-datum-datagrid

A datagrid built on react-virtualized that works with react-datum and Backbone.js

Build Status Coverage Status

Live Demo & Examples

http://zulily.github.io/react-datum-datagrid/docs/examples/#basic

Installation

Install from NPM:

npm install react-datum-datagrid --save

** Install from the web: **

Copy development (.js) or optimized (.min.js) distribution file from https://github.com/zulily/react-datum-datagrid/tree/master/dist in with your other vendor js and use a script tag or AMD to load it.

Usage

Suppose you have a Backbone Collection of puppy records such as http://zulily.github.io/react-datum-datagrid/test/lib/puppyData.js ...


let puppyCollection = new Backbone.Collection(PUPPY_DATA)

To build an infinitely scrolling datagrid with locked left columns...


class BasicDatagridDisplay extends React.Component {
  static displayName = "BasicDatagridDisplay"
  
  render(){
    // ReactDatumDatagrid will fill what ever element it is placed in
    // Below we constrain it to 100% of the demo pane and a fixed width of 600px
    // You can also use Flex!  See TODO Flexy Demo
    return (
      <div style={{height: "100%", width: 600}}>
        <ReactDatumDatagrid.Datagrid 
          collection={puppyCollection}
          columns={this.getColumns()}
          headerHeight={40}
          rowHeight={110}
          defaultColumnDef={{
            width: 150
          }}/>
      </div>
    )
  }
  
  getColumns(){
    return [{
      key: 'imageUrl',
      name: 'Image',
      width: 120,
      datum: ReactDatum.LazyPhoto,
      locked: true
    },{
      key: 'name',
    },{
      key: 'breed',
    },{
      key: 'size',
      width: 80,
    },{
      key: 'sex',
      width: 80,
    },{
      key: 'contactEmail',
      width: '200',
      datum: ReactDatum.Email,
      datumProps: {
        ellipsizeAt: false,
        reverseEllipsis: true,
      }
    }]
  }
}

window.Demo = BasicDatagridDisplay

And violà...

screenshot - click to view demo:

Column definition objects

Currently supported column feature attributes:

  • key - this is the only required attribute for all columns. It is the attribute name in the model to display and update.
  • name - the label to display in the header. May be a React Component. default: column key humanized and title cased.
  • width - the width of the column (when orientation datagrid prop is landscape)
  • height - the height of the columns (when orientation datagrid prop is portrait)
  • datum - a datum component to use for display and input. default: ReactDatum.Text
  • datumProps - props to pass datum component above
  • sortable - bool; show sort icon in column header
  • sortAttr - string attribute name to sort by if different then key
  • exportable - bool; if false, don't export this column in in csv export
  • exportAs - string to use as header in csv export. default name
  • exportAttribute - string name of attribute to export if diff than column.key
  • csvExportAttribute - string name of attribute to export to csv. defaults to exportAttr
  • exportFunction - a callback function Called with (model, columnDef, datagrid, options). If specified, has precedence over exportAttr and csvExportAttr. It should return a text or numeric value to export for the given model and column definition. Called with (model, columnDefinition, datagrid, options) where options can be forCsv: true if being exported for Csv .
  • validations - An array of methods to call with (model, columnDef, value). Each method specified must return true or the model value will not be set. Failing validations should return a string error message suitable for user comprehension.
  • cellStyle - inline styles to apply to the cell.
  • cellComponent - Component to display in cells. alias: defaultFormatter. default: ReactDatumDatagrid.Cell
  • headerComponent - Component to display in header cells. alias: header. default: ReactDatumDatagrid.HeaderCell

API Docs

The object oriented API of react-datum-datagrid is documented in our API Docs.

Enough reading, check out the demos!