The first public release of my Flex spreadsheet component is now available from Google Code. This component is very similar to the Flex datagrid with a few notable distinctions:
- It’s designed for extensibility, not for speed or ease of use.
- Item Renderers or Item Editors can implement a custom interface to get more information and control over the spreadsheet they’re in.
- They get more data about the spreadsheet.
- They can dispatch a variety of events to cause the spreadsheet to do things
- Editors don’t neccessarily need to be confined to the size of the
- It’s designed primarily for data-input, not data-display
- The spreadsheet can have a “placeholder” row.
- This row is created by the spreadsheet and is only inserted into the underlying data model when it’s “valid”.
- You can specify a class factory for creating these, and a custom validator class to determine when a row is or is not valid.
- Visually, it’s slightly greyed out.
- Keyboard navigation is sane
- Tabbing between cells
- Using the arrows between cells.
- Using the arrows within while editing a cell
- Hitting enter submits an entire row.
- Leaving a cell submits that cell
- Build-in support for auto completion of cells with sane keyboard navigation of the auto-complete
- Hitting escape cancels a cell-edit
I originally wrote this for
AgileAgenda, recently we began using it for another project at my day-job. Seeing how it was general enough for that, I thought it might be worth sharing for comments / suggestions / etc.
This component is not ready for general-use. If you want to try it out expect:
- It’s not well documented.
- There are bugs
- For large data sets (300+ rows) it’s slow
- I do have several specific plans for greatly improving this, but I like to optimize last. You never know when feature changes can really affect performance.
- The partitioning feature will be completely re-written, don’t play with it yet.
- You will have questions. I don’t have time to answer them right now.
- Many of the features (like sorting) have only been implemented enough to support my current projects and are not general enough to support every need yet.
So why am I posting this now? I’m looking for feedback. What works well, what doesn’t. What other things might you need to use it in your projects?
Getting started:
Grab the source and look at Main.mxml, it has a moderately commented example of using the component. Also, Spreadsheet.as has a few comments in it that may be useful.
If you want to test out a sample, go here:
Eventually, more information about the project will be at that URL.
UPDATE: http://www.rogue-development.com/blog/2008/03/first-public-release-of-my-flex.html
Last night I wanted to see how my component would work with custom editors that weren’t just text boxes.
Here’s a quick demo of my spreadsheet component with a custom renderer descended from a combo box. Notice a few things:
- 1 click on a cell to open, not one click to activate the cell and another to open it.
- You can keyboard navigate to it, hit the down-arrow, open the list of choices, use the arrows to select one, and then hit enter to select it, just like you should be able to.
I’m working on a spreadsheet like component for AgileAgenda that I might end up turning into a general-purpose flex component at some point.
It has a couple advantages over the Flex DataGrid class including:
- Focused on data entry instead of data display.
- Full keyboard navigation
- Arrow or tab keys to move between cells
- When editing a cell, arrows move cursor instead of cells
- “Placeholder” rows.
- Automatically created as they’re needed.
- Dimmed out rows that aren’t in the dataprovider until they’re edited.
- Uses a IFactory to create your value objects on the fly so you get any field validation that your value object implements.
- Partitions
- You can partition your data for display any way you like, independent of how it’s stored.
- Each partition can have different default values for fields.
- A row can be in 1 or more partitions.
- Expandable/Collapsible
- Autocompletion
- Comes standard just by specifying a list of possible values.
- Custom item renderers/editors
- Enhanced functionality if your editor implements a special interface, but that isn’t required.
Soon I’ll be adding:
- Full sorting of columns (without modifying the underlying data).
- Multi-cell selection and editing capabilities
- Copy/Paste multiple cells
- Clear multiple cells at once
- etc.
Here’s a quick screen cast of what’s working so far:
http://rogue-development.com/SpreadsheetDemo.swf
(Edit, changed URL of demo movie since my Jing quota is quickly approaching)