Hmm. What to do now? I guess we need to make the navigation elements we added last Wednesday actually do something. This is where we go beyond the basics though, stepping outside the idea of a "quick start" and it gets a bit complicated. I should probably have thought this through before I got this far.
There are two approaches we can take here. The most obvious approach would be to somehow have the code fetch the newly-selected view -- both its design and its data -- each time a different view is selected. This seems to be the goal of any Notes developer adapting to a new web framework -- Ext.nd have done it with Ext and it's already been done with Flex by FlexDomino.net. In both cases you select a view and it fetches the view's design and data as two separate requests and then re-builds the view on the fly.
That's all very clever (and useful if you want to quickly migrate a many-viewed database to the web) but it's not the only way to tackle things. Let's look at a way of just re-displaying the data we already have. What if we could categorise the existing data on any "field" it contained without needing to fetch anything back from the server?! Flex can do this.
Let's see an example first. Either look at the updated demo for this "series" of posts and click the "by something" links on the left or (if you're feeling underwhelmed by that) try the updated accounts.nsf which I've been working on in the background and click the "group by category" checkbox above the view.
In the both cases notice that there's no request sent to the server! How cool is that!?
To do this the first thing you need to do is switch from using a DataGrid to using an AdvancedDataGrid. Nothing tricky in that, but it does mean you'll need the professional version of Flex Builder, which is nearly three times the price of the standard version ($700 rather than $250). It's worth it for the advanced grid alone, but you also get the charts with the pro version. When combined, both features were enough to convince me to part with the extra cash.
Unfortunately I don't really have the time to talk about the code involved in categorising a previously flat "datagrid". Let's just say there's not really much to it (10 lines of code). You can see how it's done by right-clicking the demo and viewing the source. Look inside the treeItemClicked function.
Hopefully what this has shown is that you can do things differently sometimes. Although there's a big assumption in this case -- that you've already loaded the whole view. If you've only loaded the first 30 entries of the flat view then the categorised version you build might not tell the whole story!
Again it all comes down to the situation at hand, as to how you'd deal with it. It's just that it always seems to be assumed that all you want of a web-enabled Notes database is an exact copy of the client version in every way. Is that really always the case?
Whether I take this "quick start" series of posts any further I don't know yet. What do you think? Hopefully by now it's shown the power of Flex and how simple it is to achieve tangible results. Is there anything else you want to see added/tackled?