PDA

View Full Version : [CLOSED] One to Many gridpanel in looping



ermanni.info
Jul 26, 2013, 2:17 AM
Hi!

I'm looping problem working with the dynamic creation of the type GridPanel One to Many. I made based on the example provided by Baidaly via the link:

http://forums.ext.net/showthread.php?23545-CLOSED-Binding-Data-to-Dynamic-GridPanel-on-RowSelection-of-another-GridPanel&p=102925&viewfull=1#post102925

In grid parent I programmed in RowSelectionModel property Listeners.Select.Handler:



var r = new RowSelectionModel();
r.Listeners.Select.Handler = ProductGrid.ClientID + ".store.load({ params: { tid: this.getSelection()[0].data.ID } });";
StopGrid.SelectionModel.Add(r);


In grid child I programmed a proxy for running a store DirectMethod:



new Store
{
AutoLoad = false,
Model = {
new Ext.Net.Model {
IDProperty = "ID",
Fields =
{
new ModelField("ID"),
new ModelField("Name")
}
}
},
Proxy =
{
new PageProxy()
{
DirectFn = "App.direct.LoadProductData",
Reader =
{
new ArrayReader()
}
}
}
}


The grids are typically created in the Page_Load event. When I click the first time on a row of grid parent page is looping always running DirectMethod charging grid child. Thus it is not possible to manipulate the data grid child.

Using the artifice described by Baidaly in Page_Load the problem is solved but the rest stops working (editing the grid, editable header, etc..).



protected void Page_Load(object sender, EventArgs e)
{
if (X.IsAjaxRequest)
{
//We do not need to DataBind on an DirectEvent
return;
}
}


How to solve this problem?

Thanks!

Ermanni

Baidaly
Jul 26, 2013, 3:25 AM
Hello!

Can you provide full sample to investigate your issue?

ermanni.info
Jul 27, 2013, 1:54 PM

Baidaly
Jul 28, 2013, 12:05 AM
Try to replace the following at the end of Page_Load:


ReadStore();

with this one:


if (!X.IsAjaxRequest)
ReadStore();

ermanni.info
Jul 30, 2013, 3:47 AM
Hi Baidaly!

The problem was solved with the proposed solution. But now I have another case: modified "gridProd" to be editable by setting the event StoreProd.BeforeStoreChanged.

After editing a column of "gridProd" event LoadProdData runs with the parameter action = "update" and no values ​​for extraParams. Finally StoreProd.BeforeStoreChanged the event does not run.

When "gridProd" reloads the data entered are lost.

How to solve this case? Because the event BeforeStoreChanged was not executed?

Thanks!

Ermanni

Daniil
Jul 30, 2013, 5:49 AM
Hi,

A Store's OnBeforeStoreChanged event should be used only if no Proxy. In your case there is a PageProxy. It is why the OnBeforeStoreChanged event doesn't fire.

So, saving/synchronization should be done via the PageProxy as well.

ermanni.info
Jul 30, 2013, 12:03 PM
Hi Daniil!

Got it. We have an example of how to record through PageProxy. In parameter "action" noted that the property receives the value "update" but as I will have access to information that has changed?

In the event OnBeforeStoreChanged I have a list of rows and columns with the current values ​​of GridPanel. In PageProxy these values ​​also exist?

Thanks!

Ermanni

Daniil
Jul 30, 2013, 2:16 PM
Yes, an updated record (-s) will be in the "serviceParams" parameter.

ermanni.info
Aug 01, 2013, 2:11 AM
Hi Daniil!

Perfect! All working now!

Thanks!

Ermanni