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

Grid tag helper editor template

2 Answers 813 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Christian Sandöy
Top achievements
Rank 2
Christian Sandöy asked on 26 Nov 2018, 02:46 PM

Im trying to make custom editor template for inline edit mode i a .net core grid with tag helper

<kendo-grid name="grdKontaktpersoner" on-change="KontaktChange" deferred="true">
                    <datasource server-operation="false" type="DataSourceTagHelperType.Ajax" on-error="error_handler">
                        <transport>
                            <create url="/Omvisning/OpretKontakt" data="hentBestillerID" />
                            <read url="/Omvisning/HentKontakt" data="hentBestillerID" />
                            <update url="/Omvisning/OpdaterKontakt" />
                            <destroy url="/Omvisning/OpdaterKontakt" />
                        </transport>
                        <schema>
                            <model id="ID">
                                <fields>
                                    <field name="Navn" type="string" />
                                    <field name="E_Mail" type="string" />
                                    <field name="Tlfnr" type="string" />
                                    <field name="RefNr" type="string" />
                                </fields>
                            </model>
                        </schema>
                    </datasource>
                    <toolbar>
                        <toolbar-button name="create" text="Opret Kontaktperson" />
                    </toolbar>
                    <editable enabled="true" mode="inline" />
                    <scrollable enabled="false" />
                    <columns>
                        <column field="ID" hidden="true" />
                        <column field="Navn" title="Navn" editable="NavnEditor" />
                        <column field="E_Mail" title="Email"  width="200" />
                        <column field="Tlfnr" title="Telefonnr."   width="100"/>
                        <column field="RefNr" title="Ref. nr."  width="100" />
                        <column>
                            <commands>
                                <column-command name="edit" text="Ret"></column-command>
                                <column-command name="destroy" text="Slet"></column-command>
                            </commands>
                        </column>
                    </columns>
                </kendo-grid>

        function NavnEditor(container, options) {
            var grid = $('#grdKontaktpersoner').data('kendoGrid');
            $('<input required name="' + options.field + '"/>')
                .appendTo(container);
        }

the problem is that the options field in the template  is undefined

I have look at your documentation here:

https://docs.telerik.com/aspnet-core/tag-helpers/data-management/grid/overview#column-templates

what is im missing

2 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 29 Nov 2018, 10:16 AM
Hello Christian,

I have tested the grid using the same Kendo version. However, the options parameter of the editor handler is not undefined.

For your convenience I am attaching the sample I used for testing. Please examine it and let me know what I am missing.


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Christian Sandöy
Top achievements
Rank 2
answered on 29 Nov 2018, 12:32 PM

I found the error

Changed this :

@Html.Kendo().DeferredScripts()
    <script>

to this :

    <script>
        @Html.Kendo().DeferredScripts(false);

Tags
Grid
Asked by
Christian Sandöy
Top achievements
Rank 2
Answers by
Georgi
Telerik team
Christian Sandöy
Top achievements
Rank 2
Share this question
or