Lazy loading facet values when expanding tree in CubeGrid

Hello,
I’m developping an application that is using the cubegrid. I have 3 dependent facets that I have grouped in a tree facet (for the record the facets names are career, function, sub-function). I would like to load the facet values on demand in order to not to have to build the tree in advance as this would be resource consuming.
I’ve read in the documentation that facet values could be loaded on demand:
“Including lazily loading data for expanding/collapsing tree facets and when facetValues are made visible programmatically or via menus.”
From what I’ve seen in CubeGrid there is no event when a user expand a tree, there’s only a function call to a toggle_collapse function. Reading the forums I’ve seen that in that case I would have to re-create the CubeGrid after adding the facet values.
Could you give an example an how to add an event when tree facet is expanded and recreate the tree?
I’m using SmartClient v8.1
Thanks.

The CubeGrid will load data (as in CellRecords) when tree facets are expanded and collapsed, but currently there’s no support for the tree facet itself to be loaded on demand, and there is no documented framework API for picking up an event when the tree is expanded. With some low-level hacking you could add your own click handler to the DOM elements directly. The most maintainable solution is probably to sponsor a feature to make the CubeGrid capable of load on demand for tree facets:

   http://www.smartclient.com/services/index.jsp#features

Hi,
Could you give me an example of how I would add this event handler to the DOM? Could you give some pointer? I think I would have to overwrite the drawing part, since this event handler will have to be present on newly created arrow component.
Thanks.

This is an unsupported hack - but if you look at the DOM with eg Firebug you can see the turndown arrows have an onmousedown handler calling a JavaScript function on the cube. You could override that function in JSNI.

So the trick would be to override isc_CubeGrid__toggleOpenState, and call fecthData to get the facet values?
Would I have to recreate the cubegrid?

Yes, you would have to re-created the CubeGrid with the new tree facet. Note that since you’re re-creating the cube, you’re going to lose any expand/collapse state unless you are careful to preserve it, and it’s not going to be nearly as fast to re-create the cube as to just expand a tree facet that’s already loaded. Our actual recommendation is to just load the whole tree facet up front or sponsor load on demand tree facets as a new feature.

I’ve just made a query, and found that we have near from 4200 combinations in the tree (we have 3 levels), won’t this be overkill for the cube grid? Can we go that way, generating the facet values first?

This should be OK, especially if you do not need to support IE6. Just be sure that you set the tree so that it’s initially mostly collapsed.

I’ll try that then. We have to support IE7+ and the idea is to have everything closed at loading time and the user would drill down this facet.

Since there might be cases of facets with thousands of members, it would seem that our best bet is overriding isc_CubeGrid__toggleOpenState.
Can we rely on the fact that isc_CubeGrid__toggleOpenState will still be around in upcoming releases?

As was repeatedly stated above - this would be a hack and the right approach is to sponsor a feature.

Should be included basicly on the cube !

Then you can say the cube functionality is not suitable for complex business which results in thousands of combinations for facet values !!

No, that would be quite an absurd and obviously false thing to say, since the cube has been shipping with a variety of complex business applications for years.

As covered above, tree facets with thousands of nodes are fine, even though this would generally be considered poorly usability.

On legacy browsers such as IE8, displaying tens of thousands of nodes in a single tree facet may require some kind of filtering before showing the cube as such, which again would generally be a better UI, as well as more efficient.

Please! , let’s talk in a technical & practical way!. We have thousands of nodes for the facet values , about (25,000 Customers, 500 Sales Persons and about 4000 Items) which we need to combine as facets with their values (each of the past entities has a classification hierarchy ends with one of these entities as the leaf node),

What already happens is that when we are trying to load all these data (the full hierarchy with the entities as leafs) before the cube generation , the application just hangs up & become not responding anymore, that’s a normal result for loading 10s of thousands of facet values objects in the memory!

If you are suggesting some workaround here to be made please make it -technical wise- clear enough. or just dun say the cube is fine with complex business without a technical proof.
Thank you ..

PS: We are not working on IE , we are working on FF..

If you want in-depth help from Support, don’t waste Support’s time responding to baseless criticism of the product. This is the second time you’ve done so and rather than further help, the only result in going to be getting ignored.

Support already gave you an approach:

To elaborate: a tree facet with 25,000 nodes showing every single customer is a terrible UI, and will result in the user navigating forever to find the data they actually want to see, all the while loading data they don’t actually care about, which slows down the application for all users.

Instead, before showing the cube, provide a UI that allows the user to select specific customers to display. This is more usable and more efficient.

In sum, the cube doesn’t support lazy loading of facet values by default because that’s a really bad UI with poor performance.

Fist: I’m really upset for such reply ! we are a leading software house based in Egypt & we are evaluating the Enterprise edition specially for the cube functionality. Unfortunately what we get from you is a very non specific answers like “the cube has been shipping with a variety of complex business applications for years” or just like the post you mentioned, the FAQ was talking about copying & pasting things actually we dun need to run the cube! why there is no a single project for each important functionality for example ?! , I think the best way for getting advance is to listen to the evaluators complaints!

Second: Of Course that wasn’t what I mean to view 25 customers on the screen ! what I meant is to display the hierarchy for the customers & only view some customers related to some classification when this classification get collapsed.
the problem here is that the cube requires this full facet values tree of customer classifications -with the customers as the facet values tree leafs - all together! that absolutely is making a performance hit, it would be okay to load the facet value child list on collapsing it. Hope things now are clearer ..

We now explained twice that you need to provide a UI to filter customers before the cube is displayed.

This completely solves everything you think is a problem about the cube.

If you don’t understand an explanation like this, you need more intensive help such as training and consulting services.

This is also indicated by the fact that you still think there’s something wrong with the Optional Modules documentation, which continues to be correct.

We offer various commercial services you can take advantage of.

We will not make further attempts to help you on the forums, as clearly you are not going to be able to take advantage of help in this format.

Apart from your non professional reply (think again, why we haven’t such problems with hibernate forums for example !! ) ,
I understand the solution you are offering here! That’s some workaround but still the best idea to support is the facet values lazy loading , isn’t it ?

It’s not a workaround, it’s the best UI with the best performance.

Please consider your own conduct before accusing anyone else of lack of professionalism. Baseless criticism is not well-received anywhere on the internet, and in many forums, would result in being ridiculed rather than receiving further advice, as happened here.