Hierarchy Grid updata parent

Hi!

we have a problem. When i try update parent item, if parent isn't expanded is all ok, but when parent expanded it's dont work. Error chrome console:

Uncaught TypeError: Cannot read property 'find' of undefined


VIEW:

@(Html.EJ().Grid<Orden>("GridTest")
        .EnableRowHover(false)
        .Locale("es-ES")
        .Datasource(ds => ds.URL("/Grid/GetParentInfoGrid").UpdateURL("UpdateParentgrid").Adaptor(AdaptorType.UrlAdaptor))
        .AllowSelection(true)
        .AllowSorting(true)
        .EditSettings(edit => { edit.AllowEditing().EditMode(EditMode.Dialog); })
        .Columns(col =>
        {

            col.Field("OrdenId").AllowEditing(false).Visible(true).ValidationRules(v => v.AddRule("required", true)).IsPrimaryKey(true).AllowSorting(true).Add();
            col.Field("Titulo").HeaderText("Trabajo").AllowSorting(true).Add();
            col.Field("Fecha").EditType(EditingType.Datepicker).HeaderText("Fecha").AllowSorting(true).Format("{0:dd/MM/yyyy}").Add();
            col.Field("Prioridad").EditType(EditingType.Numeric).AllowSorting(true).Add();
            col.Field("TipoAveria").AllowSorting(true).Add();


        })

                .ChildGrid(child =>
                {
                    child
                       .Datasource(d => d.URL("/Grid/GetChildInfoGrid").UpdateURL("UpdateChildgrid").Adaptor(AdaptorType.UrlAdaptor))
                       .AllowSelection(true)
                       .Locale("es-ES")
                       .FilterSettings(s => s.ShowFilterBarStatus(false).FilterType(FilterType.FilterBar))
                       .ToolbarSettings(t => t.ShowToolbar(false))
                       .EnableRowHover(true)
                       .EditSettings(edit => edit.AllowEditing(true).EditMode(EditMode.Dialog))
                       .SelectionType(SelectionType.Multiple)

                       .QueryString("OrdenId")
                           .Columns(col =>
                           {
                               col.HeaderText("").Template(true).TemplateID("#checkboxTemplate").TextAlign(TextAlign.Center).Width(50).Add();
                               col.Field("Id").IsPrimaryKey(true).Visible(false).Add();//.CustomAttributes(c => c.AddAttribute("IDOrden", "'{{ :OrdenId }}'"))
                               col.Field("OrdenId").Visible(true).IsIdentity(true).Add();
                               col.Field("TrabajoARealizar").HeaderText("Operación").Add();
                               col.Field("FechaPrevista").Type("date").EditType(EditingType.Datepicker).AllowFiltering(true).HeaderText("Fecha prevista")
                                   .Format("{0:dd/MM/yyyy}").TextAlign(TextAlign.Center).Add();
                               col.Field("CuentaHoras").Add();
                               col.Field("Tipo").AllowFiltering(true).Add();
                               col.Field("Asignada").Add();

                           });

                })
                           

)



CONTROLLER:

 public ActionResult GetParentInfoGrid(Syncfusion.JavaScript.DataManager manager)
        {
            TestModel t = Session["model"] as TestModel;
          
            
            return Json(new { result = t.Ordenes, count = t.Ordenes.Count() }, JsonRequestBehavior.AllowGet);

        }
 public ActionResult GetChildInfoGrid(Syncfusion.JavaScript.DataManager manager )
        {
            int idOrden = (int) manager.Where[0].value ;
            TestModel t = Session["model"] as TestModel;

            var lista =  t.Operaciones.Where(a=>a.OrdenId == idOrden).ToList();
            return Json(new { result = lista, count = lista.Count }, JsonRequestBehavior.AllowGet);

        }

public ActionResult UpdateParentgrid(Orden value)
        {
            TestModel t = Session["model"] as TestModel;
            Orden o= t.Ordenes.Where(a => a.OrdenId == value.OrdenId).First();

            o.Titulo = value.Titulo;
            o.TipoAveria = value.TipoAveria;

            Session["model"] = t;
            return Json(value, JsonRequestBehavior.AllowGet);

        }
 public ActionResult UpdateChildgrid(Operacion value)
        {
            TestModel t = Session["model"] as TestModel;
            Operacion o =t.Operaciones.Where(a => a.Id == value.Id).FirstOrDefault();

            o.Tipo = value.Tipo;
            o.TrabajoARealizar = value.TrabajoARealizar;
            o.FechaPrevista = value.FechaPrevista;

            Session["model"] = t;
            return Json(new { result = t.Operaciones, count = t.Operaciones.Count() }, JsonRequestBehavior.AllowGet);

        }

I think is a simple sample... ¿Any idea? 

Thanks!!!

1 Reply

GV Gowthami V Syncfusion Team July 3, 2015 12:22 PM UTC

Hi David,

Thanks for using Syncfusion products.

We considered this “Script error thrown- Editing parent record while child grid expanded” as an issue and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please let us know if you have any queries.

Regards,
Gowthami V.

Loader.
Up arrow icon