Zhorian Zhorian - 1 year ago 117
Javascript Question

Updating model on kendo grid

So I have the below kendo grid on my view. At certain points an ajax call will update the Model.Id used in the model. The problem is when the Model.Id is updated the model on the grid isn't. Is there any way to update this?

.Columns(columns => {
columns.Bound(c => c.Statement).Title("STATEMENT");
columns.Command(command =>
.ToolBar(toolbar => toolbar.Create().Text("Add Statement"))
.NoRecords("No Statements Found")
.DataSource(dataSource => dataSource
.Model(model => {
model.Id(p => p.Id);
model.Field(p => p.OfferId).DefaultValue(Model.Id);
.Read(read => read.Action("GetStatementList", "OffersCreateOrUpdate", new { Area = "Offers"})
.Sort(x => x.Add("Id"))

.Create(create => create.Action("InsertStatement", "OffersCreateOrUpdate", new { Area = "Offers" })

.Update(update => update.Action("UpdateStatement", "OffersCreateOrUpdate", new { Area = "Offers" })

.Events(events => {
.Events(events => events.DataBound("offerApp.statementList_onDataBound")))



Answer Source

I managed to get around this by moving the grid into a partial view and rendering it once I had a valid Model.Id.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download