PDA

View Full Version : [CLOSED] [Razor] Row expander + multiple direct events



machinableed
Jun 20, 2012, 10:15 AM
Hi there,

I have a grid panel with row expander that has 2 grids within it that I want to populate via ajax methods that call the controller before expand. I've got it working with a single grid like shown:

.DirectEvents(rowExp =>
{
rowExp.BeforeExpand.ExtraParams.Add(new Parameter("ProductInstanceId", "record.data['ProductInstanceId']", ParameterMode.Raw));
rowExp.BeforeExpand.Url = "/Products/ExpandServices";
rowExp.BeforeExpand.Success = "#{childServiceStore}.loadData(result.data);";
})

How can I got about populating the 2nd grid? all my attempts/experiments end with a "Only one item is allowed in this Collection." exception

machinableed
Jun 20, 2012, 11:53 AM
I've got around the initial exception by putting both gridpanels within a containing panel but now I find only one beforeexpand direct event will fire

Daniil
Jun 20, 2012, 1:36 PM
Hi,


I've got around the initial exception by putting both gridpanels within a containing panel but now I find only one beforeexpand direct event will fire

Do you expect the BeforeExpand should be fired twice? Why?

I think one RowExpander - one BeforeExpand. Generally, RowExpander knows nothing about its content - there is a single GridPanel or two GridPanels or something else.

Or, maybe, am I misunderstanding something?

machinableed
Jun 20, 2012, 2:22 PM
i don't expect it to fire twice, i'm just wondering if there is a way I can effectively do the same thing either in parallel or sequentially... my problem is that when i expand the row I want to populate 2 grids (via 2 stores)... basically when i expand the row I want to do what i'm doing in the first post to populate the first grid but then I'm unsure how to populate the 2nd grid at the same time (which is set up in a similar way to the first but has a different store and calls a different controller method).

Daniil
Jun 20, 2012, 7:49 PM
Could you clarify why you can't populate the grids at the same time?

What are the Stores configurations?

For example, you could set up some Proxies for the Stores and call

Store1.load();
Store2.load();
within the BeforeExpand listener.

machinableed
Jun 21, 2012, 3:39 AM
Okay - I've sorted my problem out by using direct methods instead of a direct event - thanks for your help