logo

Flex With Domino Quick Start - Part 4

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.

ScreenShot002 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?

Comments

  1. I love the flex tutorials you've posted. Hopefully it will result in more Flex/Domino awareness. I personally would love to work on Flex/Domino apps, but it doesn't currently fit into any of my projects.

    I don't know if you've mentioned it, but have you used it in any real-world applications?

    Did you feel the platform was limiting in any way?

    How RAD is Flex compared to ExtJS?

    • avatar
    • Nagarajan P.V.
    • Mon 2 Feb 2009 05:29 AM

    The updated accounts.nsf in this article is pointing to

    http://www.codestore.net/apps/account.nsf/

    instead of

    http://www.codestore.net/apps/accounts.nsf/

    Please correct the link

    • avatar
    • Jake Howlett
    • Mon 2 Feb 2009 05:39 AM

    Thanks Nagarajan. Fixed now.

    Tommy. Yes, I've been using on actual applications for paying clients (I wouldn't be able to justify the $750 otherwise!). None that I can show here though, unfortunately.

    Flex and ExtJS aren't even in the same league of RADness. For me at least. With ExtJS it's RAD until you get stuck and then I find it very nonRAD. The fact that Flex has a WYSIWYG IDE makes it RADder on its own.

    I am yet to find a limitation of Flex!

  2. I get the following when trying to view source:

    Http Status Code: 404

    Reason: File not found or unable to read file

    Am I doing something wrong?

    Thanks

    David

    • avatar
    • Jake Howlett
    • Mon 2 Feb 2009 08:14 AM

    No David. My fault. Looks like the view source URL is relative. My link to the app opened "/apps/flex.nsf" whereas it should have opened "/apps/flex.nsf/". Add the slash and it will work.

    • avatar
    • Aritz
    • Mon 2 Feb 2009 09:08 AM

    Hi Jake,

    First at all congratulations for this magnific help!!

    Can you hide elements like fields, buttons based on lotus domino roles?

    Thank in advance!

    • avatar
    • Jake Howlett
    • Mon 2 Feb 2009 09:33 AM

    You don't want much do you Aritz? ;o) Leave it with me and I'll make that the next Flex quick start post.

  3. Jake... great work. I would like to see your source for creating the document in the account application. I have not tried to create a document yet with Flex.

    Aritx / Jake... once the user logs in, couldn't you call an HTTP service that calls a Notes Agent that prints XML with the Effective User Name (run as web user) and inside the agent do an x = Evaluate(|@UserRoles|) and return formatted XML to show the user name and roles?

  4. Hi Jake,

    Check out our domino based app....found here:

    http://flexingdomino.blogspot.com/

    covers login, roles, events, event dispatch etc...

    fairly comprehensive app w/ domino

    cheers,

    Mark

    • avatar
    • Jono
    • Mon 2 Feb 2009 04:24 PM

    How about a reporting (charts) quick start post Jake? All great stuff - you have me inspired. Am trying to squeeze as much time as I can playing with Flex.

  5. Hey -- put a multi-billion dollar company behind ExtJS like Adobe, and I'm sure they could come up with a GUI for you. :P

    Last I heard, they're going to have a pretty good version of exactly that with ExtJS 3.0 when it comes out.

  6. Great stuff Jake. Since you askedI would like to see some charting examples using Domino data. That kind of eye candy always sells management!

    • avatar
    • Jake Howlett
    • Thu 5 Feb 2009 06:24 AM

    I'll try and cover that too Curt. There's an example in the account.nsf db, which I'll make an updated version available to shortly.

  7. In the line below: is"selectedNode.@categoryField" a string? I am trying to duplicate your example, but I am hard coding the GroupingField. It blows up.

    group.fields = [new GroupingField(selectedNode.@categoryField)];

    Thanks, David

    • avatar
    • Jake Howlett
    • Thu 5 Feb 2009 04:45 PM

    Hi David,

    Yes, it's a string. The selectedNode corresponds to the <node> from the XMLList used to render the tree. See further down the MXML something like this:

    <mx:XMLList id="xmlNavElements">

    <node label="Cars">

    <node label="By Engine Size" categoryField="size" />

    The categoryField is a attribute of the node I made up. You can add any you like and then reference them as node.@myMadeUpAttrribute

    So, in this case it would be something like "size" or "manufacturer". The important part is that these "map" to the names of actualy XML "fields" in the data of the dataProvider to the grid.

    Hope that makes sense?

    Jake

  8. What version of Flex Builder are you using? I copied your source and ran it in Flex 3. The original grid loads, but I get an action script error when it is time to group the grid.

    • avatar
    • Jake Howlett
    • Fri 6 Feb 2009 12:32 PM

    Same version as you by the sounds of it David

  9. Had to update Flex 3.02. This is great stuff Jake.

    Thx, David.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Mon 2 Feb 2009

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

More Content