Kendo grid update - update click of any row shows 1st row details -
i facing issue kendo grid inline editing, issue though update row, 1st row data displayed in grid, on this?
before update
after update.
interestingly object return controller have correct data
controller code
[acceptverbs(httpverbs.post)] [validateantiforgerytoken] [actionsessionstate(system.web.sessionstate.sessionstatebehavior.required)] [outputcache(duration = 0, varybyparam = "none")] public actionresult _savebatcheditingintegrate([datasourcerequest] datasourcerequest request) { var upobj = sessionfacade.userprofile userprofile; try { integrationrate objinteg = new integrationrate(); tryupdatemodel(objinteg); if (objinteg.periodid != 0) { var integrationrate = (from p in _draftmanagecompany.integrationrates p.periodid == objinteg.periodid select p).first(); tryupdatemodel(integrationrate); if (integrationrate.rate > 100) //set 100 default { integrationrate.rate = 100; } } loadresourcejsarray(); } catch (exception ex) { // adding related additional information along exception object //exceptionlogger.log(ex, "period id", id); exceptionlogger.log(ex, "user profile info", upobj); // handle exception bubbleexceptionpolicy if (exmanager.handleexception(ex, "bubbleexceptionpolicy")) throw; // not include ex, previous stack trace maintained } //_draftmanagecompany.integrationrates contains updated value in correct order return json(_draftmanagecompany.integrationrates.todatasourceresult(request)); }
cshtml code:
@{ var integrategrid = html.kendo() .grid(model.company.integrationrates) .name("gridintegrate") .enablecustombinding(true) // enable custom binding .bindto(model.company.integrationrates) .events(events => { events.change("databound_integ"); }) .toolbar( commands => { //commands.insert().buttontype(gridbuttontype.bareimage).imagehtmlattributes(new { style = "visibility:hidden" }); } ) .columns(columns => { columns.bound(p => p.periodid).visible(false); columns.bound(p => p.month).width(150); columns.bound(p => p.rate).format("{0:0.00}%").width(100); columns.command(commands => { commands.edit().htmlattributes(new { @id = "btn_intrateedit" }); }).width(150).title(gridtitle); }) .htmlattributes(new { style = "height: 380px;" }) .scrollable() .editable(editable => editable.mode(grideditmode.inline)) .datasource(datasource => datasource.ajax() //.batch(true) .read(read => read.action("_ajaxbindingintegrate", "company")) .update(update => update.action("_savebatcheditingintegrate", "company")) .model(model => { model.id(c => c.periodid); model.field(c => c.month).editable(false); } ) .events(events => { events.error("checksessionexistsontelerik"); }) ); //.pageable(paging => paging.style(gridpagerstyles.nextpreviousandnumeric | gridpagerstyles.pagesizedropdown).pagesize(20, new int[3] { 20, 50, 100 })).tocomponent(); var culture = system.globalization.cultureinfo.invariantculture; //integrategrid.localization = new gridcontrollocalization(culture); integrategrid.render(); }
i think see problem here. can tell when complete update returning entire data set on update ie june, january, february etc.
on update have return item have updated grid
so in example change return json following:
return json(new { integrationrate}.todatasourceresult(request,modelstate),jsonbehaviour.allowget);
this should sort out issue.
because returning entire data set rendering first row expected result.
as see data saving correctly behind scenes. know error not being thrown.
Comments
Post a Comment