PDA

View Full Version : [CLOSED] Refresh store after AfterRecordUpdated event



methode
Oct 22, 2008, 6:01 AM
Hi Geoff,

I setted a Store with RefreshAfterSaving = always, OnAfterRecordUpdated, OnAfterRecordInserted, and OnRefreshData.

While I correctly use refresh data after I inserted a record in my Grid, RefreshData evet fires, after I updated a record,
click save, OnAfterRecordUpdated fires, I implemented my logic to update the business object
but OnRefreshData event DOES NOT fire! So that I can't see changes (updates) I made in the Grid.
I need to click refresh button to see made changes.

Is this normal, or am I doing something wrong?

Thank you

Matteo

Vladimir
Oct 22, 2008, 6:17 AM
Hi,

The OnRefreshData fires only if on the client side was called load/reload methods of store/grid
During AjaxEvent you can call DataBind of Store for update data on client.

If it is not helps you then please post simple example which demonstrating the problem and i'll try to help you

methode
Oct 22, 2008, 6:45 AM
Hi Vlad,

thanx for quick response, I have this code in the Grid:




<ext:Button runat="server" ID="BT_SalvaQuest" Text="Salva" Icon="Disk">
<Listeners>
<Click Handler="#{MyGridPanel}.save();" />
</Listeners>
</ext:Button>



and this codebehind:




// this works fine, after this, code passes to Refresh event
protected void MyStore_AfterRecordInserted(object sender, AfterRecordInsertedEventArgs e)
{
this.SaveObject(e);
}

// after this call, code does not pass to Refresh evet
protected void MyStore_AfterRecordUpdated(object sender, AfterRecordUpdatedEventArgs e)
{
this.SaveObject(e);
this.MyStore.DataBind(); // I tried this without success
}

protected void MyStore_Refresh(object sender, StoreRefreshDataEventArgs e)
{
this.MyStore.DataBind();
}



Thank you

Matteo

Vladimir
Oct 22, 2008, 7:25 AM
Hi,

During saving process the DataBinding doesn't allowed because it can breaks saving logic. I reproduced bug in RefreshAfterSaving property. I can suggest a few solutions while i fixing bug

1. Set RefreshAfterSaving=Always and to add DataSourceProxy to your Store


<Proxy>
<ext:DataSourceProxy/>
</Proxy>


2.Another solution: Set RefreshAfterSaving=None and to add listener for Store


<CommitDone Handler="#{Store1}.reload();" />

methode
Oct 22, 2008, 7:50 AM
Thank you Vlad,

ok! I tried both solutions, they work fine.
I adopted the first one and had the result I expected.

Matteo

rajputamit
Nov 23, 2010, 11:24 AM
Hi,

I have added column model in grid panel from code behind.





foreach (DataColumn dc in dtData.Columns)
{
if (count > 3)
{
Column co = new Column();
co.Width = Unit.Pixel(75);
co.DataIndex = dc.ColumnName;
co.Header = dc.ColumnName;
TextField c = new TextField();
c.ID = count.ToString();
co.Editor.Add(c);
this.GridPanel1.ColumnModel.Columns.Add(co);
}
count++;
}



I am adding Textfield as above.

Now I want to validate each textField as decimal or int.

Also total row should not be editable and color of that row should be different.

Please refer the attachement.

Daniil
Nov 23, 2010, 5:25 PM
Hi,

Please create a new thread because your question is not rather related to this thread.