EditorTemplateName results in empty cell for view

3 posts, 0 answers
  1. Jason
    Jason avatar
    2 posts
    Member since:
    Nov 2016

    Posted 12 Dec 2016 Link to this post

    I have the following grid:

                    .Columns(columns =>
                        columns.Command(command => command.Custom("-").Click("deleteNominalInvoiceRowItem").HtmlAttributes(new { @class = "button-small", id = "deleteId" })).Width(40);
                        columns.Bound(c => c.Id).Hidden(true).FormClientTemplate("Items", "Items");
                        columns.Bound(c => c.NominalCode)
                            .FormClientTemplate("Items", "Items");
                        columns.Bound(c => c.Description).FormClientTemplate("Items", "Items");
                        columns.Bound(c => c.NetAmount).HtmlAttributes(new { style = "text-align: right;" })
                            .ClientFooterTemplate("#= gridItemsFooterNetAmount() #").Format("{0:c}").FormClientTemplate("Items", "Items");
                        columns.Bound(c => c.VatAmount).HtmlAttributes(new { style = "text-align: right;" })
                            .ClientFooterTemplate("#= gridItemsFooterVatAmount() #").Format("{0:c}").FormClientTemplate("Items", "Items");
                        columns.Bound(c => c.TotalAmount).HtmlAttributes(new { style = "text-align: right;" })
                            .ClientFooterTemplate("#= gridItemsFooterTotalAmount() #").Format("{0:c}").FormClientTemplate("Items", "Items");
                    .HtmlAttributes(new { style = "height: 300px;" })
                    .Selectable(x => x.Mode(GridSelectionMode.Single).Type(GridSelectionType.Cell).Enabled(true))
                    .Editable(x => x.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom))
                    .ToolBar(x =>
                        x.Custom().Text(RCdisplay.Clear_All).HtmlAttributes(new { id = "clearItems" });
                    .Events(x => x.Edit("onNominalInvoiceItemsGridEdit").Change("onNominalInvoiceItemsGridEdit").Save("onNominalInvoiceItemsGridSave"))
                    .DataSource(dataSource => dataSource
                        .Read(read => read.Action("InvoiceItemsGrid_Read", "Invoicing", new { Area = "Invoicing" }))
                        .Create(create => create.Action("InvoiceItemsGrid_Insert", "Invoicing", new { Area = "Invoicing" }))
                        .Update(update => update.Action("InvoiceItemsGrid_Update", "Invoicing", new { Area = "Invoicing" }))
                        .Model(m =>
                            m.Id(p => p.Id);
                            m.Field(p => p.NominalCode);
                            m.Field(p => p.Description);
                            m.Field(p => p.NetAmount);
                            m.Field(p => p.VatAmount);
                            m.Field(p => p.TotalAmount);


    The EditorTemplateName causes the grid to have an empty cell (it actually contains a hidden field with the value selected) when not in edit mode.

    From what i read, the ClientTemplate as I have it should display the value selected.

    Is there anything else I need to do to get the selected value displayed as a span when not in edit more?



  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 14 Dec 2016 Link to this post

    Hi Jason,

    Indeed, when using a ClientTemplate the content of the template should be render on the page when the grid is in view mode. However, could you please verify that you are not receiving any client exception which might prevent showing the value? Additionally I noticed that you are using a FormClientTemplate method in your case. Is that a custom method since the Bound column does not have such method built-in.

    I am looking forward to your reply.

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Jason
    Jason avatar
    2 posts
    Member since:
    Nov 2016

    Posted 14 Dec 2016 in reply to Kostadin Link to this post

    Thanks for the reply Kostandin, my problem after all was that the name of the autocomplete needed to be the same as the name of the property of the model bound to the grid. As soon as I changed it it started displaying the selected text as a label when not in edit mode.
Back to Top