In my view have this:
@{
var properties = db.StylesPropertyDefs.OrderBy(o => o.PropertyId);
}
..
..
@(Html.X().GridPanel()
.Title("Array Grid")
.ID("propertyGrid")
.Width(600)
.Height(350)
.Store(Html.X().Store()
.Model(Html.X().Model()
.Fields(
new ModelField("PropertyId", ModelFieldType.Int),
new ModelField("PropertyName", ModelFieldType.String),
new ModelField("PropertyShortName", ModelFieldType.String),
new ModelField("PropertyActiveFlag", ModelFieldType.Boolean)
)
).DataSource(properties)
..
..
And i have an action in the controller to add new property. The new property is added successful but I can refresh the PanelGrid (without refresh the whole page). Here is the controller:
[DirectMethod]
public ActionResult AddNewProperty(string propertyName, string propertyCode, bool propertyActive)
{
if (propertyName == "" || propertyCode=="")
{
X.Msg.Show(new MessageBoxConfig
{
Title = "Error",
Message = "The field name or code can not be empty.",
Buttons = MessageBox.Button.OK,
Icon = MessageBox.Icon.ERROR
});
return this.Direct();
}
//if all is ok add new property
var newOne = new StylesPropertyDef
{
PropertyActiveFlag = propertyActive,
PropertyName = propertyName,
PropertyShortName = propertyCode
};
var db = new TaosKnowledgeDataContext(DataUtils.GetConStringLocal());
db.StylesPropertyDefs.InsertOnSubmit(newOne);
db.SubmitChanges();
//reload properties
var properties = db.StylesPropertyDefs.OrderBy(o => o.PropertyId);
var theGrid = X.GetCmp<GridPanel>("propertyGrid");
//now i need refresh or reload the panel grid.
X.GetCmp<Window>("AddNewProperty").Close();
return this.Direct();
//return RedirectToAction("StyleProperties");
}
So, resuming, I need refresh the PanelGrid datasource(or store) from the controller. Please can you help me?