Skip to content

Commit

Permalink
table state supported
Browse files Browse the repository at this point in the history
  • Loading branch information
stevewirts committed Mar 11, 2015
1 parent 1680de6 commit eb14f1d
Show file tree
Hide file tree
Showing 37 changed files with 426 additions and 152 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,34 @@ Hypergrid comes with several default cell editors you can easily select, and the
* [textfield](http://openfin.github.io/fin-hypergrid/components/fin-hypergrid/#fin-hypergrid-cell-editor-textfield)
<br><img src="images/textfield.png" alt="screenshot">

## JSON table state
Hypergrid allows you to snapshot the user configured state and then reapply it later(memento pattern) this includes.
* column order
* column widths
* row heights
* sorted column asc/des

to do this
1. configure the table the way you would like
2. call ```var state = myGrid.getState();```
3. save the state object however you, json/local storage/mongodb/etc...
4. call ```myGrid.setState(state);``` to return the table to the previous state

this table will produce a state object
<img src="images/gridshot06.png" alt="screenshot">
{
"columnIndexes":[8,7,1,3,2,4,6], //column order
"fixedColumnIndexes":[0], //fixed columns order
"hiddenColumns":[5,0], //hidden column indexes
"columnWidths":[66,50,51,81,73,96,78,74,60], //
"fixedColumnWidths":[53], //
"rowHeights":{"1":46,"3":51,"5":51,"7":50}, //
"fixedRowHeights":{}, //
"sorted":[0,0,0,0,0,0,0,1,0] //1 ascending, 2 descending
}

state objects can be created programmatically or by hand and applied. This is how you may pre configure your table.

## Road Map
* Column autosizing
* Fix live reload on file change edge conditions
Expand Down
Loading

0 comments on commit eb14f1d

Please sign in to comment.