GithubHelp home page GithubHelp logo

fredkneeland-wf / fixed-data-table Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookarchive/fixed-data-table

0.0 0.0 0.0 5.42 MB

A React table component designed to allow presenting thousands of rows of data.

Home Page: http://facebook.github.io/fixed-data-table/

License: Other

JavaScript 90.86% Shell 0.51% CSS 7.81% Dart 0.82%

fixed-data-table's Introduction

Fixed Data Tables for Dart React

This repo was created to allow FaceBook's FixedDataTable react component to be used in Dart. For the original source go to: https://github.com/facebook/fixed-data-table

Getting started

To use this repo include it in your pubspec.yaml as a git dependency

fixed_data_table:
    git:
      url: [email protected]:fredkneeland-wf/fixed-data-table.git
      ref: 1.0.0

In your html page include

<link rel="stylesheet" href="packages/fixed_data_table/fixed-data-table.css">
<script src="packages/fixed_data_table/fixed-data-table.js"></script>

Then in your dart file import this package:

import 'package:fixed_data_table/fixed-data-table.dart';

Then inside of your render file include something in the form:

FixedDataTable({'rowHeight':rowHeight, 'rowGetter':rowGetterFunc, 'rowsCount':rowArray.length, 'width':TableWidth, 'height':TableHeight,'headerHeight':HeaderHeight,'groupHeaderHeight':GroupHeaderHeight}, [
        FixedDataTableColumnGroup({'label':'Users', 'width':650}, [
          FixedDataTableColumn({'width':col1Width,'cellRenderer': col1Input, 'dataKey':'col1Param'}),
          FixedDataTableColumn({'width':col2Width,'cellRenderer': col2Input, 'dataKey':'col2Param'})
        ]),
])

col1Width, col2Width, rowHeight, TableWidth, TableHeight, HeaderHeight, and GroupHeaderHeight are all numerical props

rowGetterFunc is a function that returns an object with the row data for an index i.e.

rowGetterFunc(rowIndex) {
  return rowArray[index];
}

rowArray is an array of objects that contain the data you want for your chart i.e.

var rowArray = [
  {
    'name':'name',
    'age':10
  },
  {
    'name2':'name2',
    'age':15
  }
];

col1Input and col2Input are functions that return the react component for a given row determined by dataKey i.e.

  col1Input(data) {
      return div({}, [
        data
      ]);
  }
  
  col2Input(data) {
        return div({}, [
          Input({'key':'1:${data}', 'onChange': onChangeFunc, 'type': 'radio', 'label': 'owner', 'value': '3', 'name': 'name', 'checked': false})
        ]);
    }

The parameter data will be rowArray[index]['col1Param'] if you only want to display the data and don't want to render a react component you can ommit the 'cellRenderer' prop.

Make sure to wrap a react component in a div as in the above examples as without it you will get an error.

If you have any questions feel free to ping me on hipchat or email me at [email protected]

License

FixedDataTable is BSD-licensed. We also provide an additional patent grant.

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.