We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Hierarchy Grid updata parent

Thread ID:

Created:

Updated:

Platform:

Replies:

119511 Jul 2,2015 08:48 AM UTC Jul 3,2015 12:22 PM UTC ASP.NET MVC 1
loading
Tags: Grid
David
Asked On July 2, 2015 08:48 AM UTC

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!!!

Gowthami V [Syncfusion]
Replied On 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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;