This is a migrated thread and some comments may be shown as answers.

[Solved] After row Edit: Checkmark does not show correct value

3 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Frank Michael
Top achievements
Rank 1
Frank Michael asked on 18 May 2010, 12:26 PM
I have this grid:
c.Bound(r => r.Urgent).ReadOnly(false
                .ClientTemplate("<input type='checkbox' disabled='disabled' name='Urgent' <#= Urgent? checked='checked' : '' #> />"); 
            c.Bound(r => r.Important).ReadOnly(false
                .ClientTemplate("<input type='checkbox' disabled='disabled' name='Important' <#= Important? checked='checked' : '' #> />"); 
It is client bound.
I also have
 c.Command(s => 
            { 
                s.Select(); 
                s.Edit(); 
                s.Delete();  
            }) 
When I edit the row, the values are updated, but if the grid turns to display only mode again, then the new checked values are not displayed.
I have checked in the debugger, if the value is set and if it is correctly retrieved from the database.
[Authorize] 
        [GridAction] 
        public ActionResult AjaxGridUpdate(string id)  
        { 
            var trans = new PlatformTransaction(); 
            var bon = new BusinessObjectNode<Workitem>(trans); 
 
            bon.Retrieve(id); 
 
            var workitem = bon.Entity(id); 
 
            workitem.Title = Request.Form["Title"]; 
            workitem.RemainingDays = double.Parse(Request.Form["RemainingDays"]); 
            workitem.RemainingHours = double.Parse(Request.Form["RemainingHours"]); 
            workitem.Status = Request.Form["Status"]; 
            workitem.Urgent = bool.Parse(Request.Form["Urgent"]); 
            workitem.Important = bool.Parse(Request.Form["Important"]); 
 
            //if (TryUpdateModel<Workitem>(workitem, new string[] { "Title" })) 
            //{ 
                workitem.ChangedAt = DateTime.UtcNow; 
                workitem.ChangedBy = System.Web.HttpContext.Current.User.Identity.Name; 
 
                bon.Update(workitem); 
 
                trans.Save(); 
            //} 
 
            var fatherId = workitem.SuperWorkitem; 
 
            var vd = SelectGridModel(fatherId); 
 
            return View(new GridModel(vd.gridRows));  
        } 
So yes, the value is set and it is correctly retrieved from the db. It is there in vd before I return it.
So it is a display problem

3 Answers, 1 is accepted

Sort by
0
Frank Michael
Top achievements
Rank 1
answered on 18 May 2010, 12:32 PM
I just checked in the JSON return.
There strangely the value "Urgent" is not set. So in vd it is set, in the JSON reply not.

?!?!
0
Frank Michael
Top achievements
Rank 1
answered on 18 May 2010, 01:12 PM
Hold on - no. It is a save problem.
I believe the reason is, that I have save options that save only the non-null attributes. That's because the row of a table does not contain all attributes of the model object. I think I have to read the object completely before I update it. Or is there a possibility to read all attributes from the grid, even if they are not displayed?
0
Frank Michael
Top achievements
Rank 1
answered on 18 May 2010, 01:21 PM
I solved it myself.
Tags
Grid
Asked by
Frank Michael
Top achievements
Rank 1
Answers by
Frank Michael
Top achievements
Rank 1
Share this question
or