2.1.0 • Published 9 years ago

table-editor v2.1.0

Weekly downloads
183
License
-
Repository
github
Last release
9 years ago

table-editor

a module for creating a very simple editor for tabular data.

Install

npm install --save table-editor

It's designed for use with browserify, but you can alternatively grab the table-editor.js file.

Examples

Simple example:

var fs = require('fs');
var on = require('component-delegate').bind;
var TableEditor = require('table-editor');
var template = fs.readFileSync(__dirname + '/table.html', 'utf8');

var editor = new TableEditor({
  el: 'editor',
  template: template,
});

editor.import([
  { example: 'weeeee', wat: 'wooooo' },
  { example: 'weeeee', wat: 'wooooo' },
  { example: 'weeeee', wat: 'wooooo' }
]);

editor.on('change', function (change) {
  console.log(editor.data.rows);
});

on(document.body, '#add-row', 'click', function(e) {
  editor.addRow();
});

on(document.body, '#add-column', 'click', function(e) {
  var name = window.prompt('New column name');
  editor.addColumn({ name: name, type: 'string' });
});

Check out the rest of the above example, including an index.html file and the table.html template in the gh-pages branch of this repo.

Extended example

This module is being created specifically for this project: http://github.com/flatsheet/editor

Check out that repo for an extended example of table-editor usage, including an alternate table template and pretty much full usage of the table-editor API.

You can see the flatsheet example in action here: http://flatsheet.io/editor

Contributing

Note: The table-editor.js file is bundled for each release. Edit the index.js file.

  • Fork this repository
  • Create your feature branch: git checkout -b new-feature
  • Commit your changes: git commit -m 'Add new feature'
  • Push to the branch: git push origin new-feature
  • Submit a pull request via GitHub

License

MIT

2.1.0

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.1.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.7.5

10 years ago

0.7.4

10 years ago

0.7.3

10 years ago

0.7.2

10 years ago

0.7.1

10 years ago

0.7.0

10 years ago

0.6.0

10 years ago

0.5.0

10 years ago

0.4.5

10 years ago

0.4.4

10 years ago

0.4.3

10 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.1

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago