PDA

View Full Version : [CLOSED] Problem with store reload



matrixwebtech
Jun 21, 2014, 11:47 AM
Controller


public ActionResult reloadgrid()
{
object[] o = GetData().Cast<object>().ToArray();
return this.Store(o);
}


Button Code in View


X.Button()
.Text("Save")
.ID("btnSave")
.Listeners(l => l.Click.Handler = "return validation();")
.DirectEvents(de =>
{
de.Click.FormID = "f";
de.Click.Action = "save";
de.Click.EventMask.ShowMask = true;
de.Click.EventMask.Msg = "Saving...";
de.Click.EventMask.MinDelay = 100;
de.Click.After = "App.GridPanel1.getStore().reload();";
}),

Code in gridpanel in view


.ServerProxy(X.AjaxProxy()
.Url(Url.Action("reloadgrid", "DefindTask"))
.Reader(X.JsonReader().Root("data"))
)

The problem is,data in grid not refresh every time ,for example,I click on save 3 times grid data refresh on 4th time not refresh but when i click for 5th time its working again.that means on 4th click grid not showing 4 rows its shows 3rows but on 5 4th click its shows 5 rows including the 4th row.

And its happen frequently.but not any sequence ,Its happen sometime after 1click sometime on 5th click or 10th click.Is there any problem in my code?

Daniil
Jun 21, 2014, 6:02 PM
Hi @matrixwebtech,

Please replace

de.Click.After
with

de.Click.Success
or

de.Click.Complete

With that change it should work well.

An After handler is executed after client-side part of a DirectEvent. Just after making a request to server, but the request hits server.