Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
igGrid date column in parent layout not formatting
posted

I am using the code below to generate a grid with two tiers of data: a support ticket, and the entries on that support ticket.

The main issue I am running into is that the Main Layout's datetime columns are not formatting, but the child layout's columns are. I am applying formatting the same way to both, and both are pointing to DateTime? variables in classes within my model.

Is there any way to get these to both format?

The Main Layout formats the date: 2017-11-05T09:19:40.663Z

The Child Layout formats the date: 2/22/2018 7:17 AM

<div class="ui-iggrid">
            @(Html.Infragistics().Grid(Model.GetIncidents()).ID("grdIncidents")
                                                                    .EnableUTCDates(true)
                                                                    .PrimaryKey("IncID")
                                                                    .AutoGenerateColumns(false)
                                                                    .AutoGenerateLayouts(false)
                                                                    .DataBind()
                                                                    .LoadOnDemand(true)
                                                                    .Columns(column =>
                                                                    {
                                                                        column.For(x => x.IncID).HeaderText("IncID").Width("*").DataType("int").Template("<a href='TicketTrackerTicket?IncID=${IncID}'>${IncID}</a>");
                                                                        column.For(x => x.CustCode).HeaderText("CustCode").Width("*");
                                                                        column.For(x => x.Subject).HeaderText("Subject").Width("100%");
                                                                        column.For(x => x.TechID).HeaderText("Tech").Width("*");
                                                                        column.For(x => x.LastUpdateDate).HeaderText("LastUpdateDate").Width("*").DataType("Date").Format("DateTime");
                                                                        //column.For(x => x.LastUpdateDate).Width("*").DataType("date").Format("dateTime");
                                                                    })
                                                                    .ColumnLayouts(layout =>
                                                                    {

                                                                        layout.For(x => x.IncidentsHistory)
                                                                            .EnableUTCDates(true)
                                                                            .ForeignKey("IncID")
                                                                            .AutoGenerateColumns(false)
                                                                            .AutoGenerateLayouts(false)
                                                                            //.DataBind()
                                                                            .LoadOnDemand(true)
                                                                            .Columns(cols =>
                                                                            {
                                                                                //cols.For(x => x.IncID).HeaderText("IncID");
                                                                                cols.For(x => x.NoteDate).HeaderText("Entry Date").Width("*").DataType("date").Format("dateTime");
                                                                                cols.For(x => x.Contact).HeaderText("Entry By").Width("*");
                                                                                cols.For(x => x.Description).HeaderText("Entry").Width("100%");
                                                                            })
                                                                            .Features(layoutF =>
                                                                            {
                                                                                layoutF.Sorting().Mode(SortingMode.Multiple).ColumnSettings(settings =>
                                                                                {
                                                                                    settings.ColumnSetting().ColumnKey("NoteDate").FirstSortDirection("descending");
                                                                                });
                                                                                layoutF.Filtering().Mode(FilterMode.Simple).Type(OpType.Local);
                                                                            });
                                                                    })
                                                                    .Features(f =>
                                                                    {
                                                                        f.Paging().PageSize(25);
                                                                        f.Sorting().Mode(SortingMode.Multiple).ColumnSettings(settings =>
                                                                        {
                                                                            settings.ColumnSetting().ColumnKey("LastUpdateDate").FirstSortDirection("descending");
                                                                        });
                                                                        f.Filtering().Mode(FilterMode.Simple).Type(OpType.Local).ColumnSettings(settings =>
                                                                        {
                                                                            //settings.ColumnSetting().ColumnKey("CustCode").DefaultExpressions(new List<DefaultFilterExpression>
                                                                            //{
                                                                            //    new DefaultFilterExpression()
                                                                            //    {
                                                                            //        Condition = "equals", Expression = Model.CustCode
                                                                            //    }
                                                                            //});
                                                                            //settings.ColumnSetting().ColumnKey("CustCode").DefaultExpressions(new List<DefaultFilterExpression>
                                                                            //{
                                                                            //    new DefaultFilterExpression()
                                                                            //    {
                                                                            //        Condition = "equals", Expression = Model.CustCode
                                                                            //    }
                                                                            //});
                                                                            //if (Model.CustCode != "PDMD")
                                                                            //{
                                                                            //    settings.ColumnSetting().ColumnKey("CustCode").Setting.AllowFiltering = false;
                                                                            //}
                                                                        });

                                                                    })
                                                                .Render()
            )
        </div>