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

How to define an custom grid edit template?

9 Answers 661 Views
This is a migrated thread and some comments may be shown as answers.
K
Top achievements
Rank 1
K asked on 12 Jul 2018, 02:19 PM
How to define an custom grid edit template?

9 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 16 Jul 2018, 08:41 AM
Hello,

The Kendo UI for Vue wrappers support native Vue templates, through using single-file components as demonstrated on the following documentation article:

I have prepared a sample on CodeSandBox, where the above approach is demonstrated with the Grid widget. To achieve the desired result, I have followed the below described steps:

1) Configure the Grid edit mode to popup and also specify the editable template:

<kendo-grid :height="600" ref="'grid'"
     :data-source-ref="'datasource1'"
     :editable-mode="'popup'"
     :editable-template="popupTemplate">
  ...       
</kendo-grid>

2) Create the template file (PopupTemplate.vue):
<template>
    <p>Custom Template</p>
</template>
 
<script>
  export default {
    name: "popupTemplate",
    data() {
      return {
        templateArgs: {}
      };
    }
  };
</script>

3) Import the template to the Grid view:
<script>
import Template from "./PopupTemplate.vue";
import Vue from "vue";
 
export default {
  name: "HelloWorld"
  methods: {   
    popupTemplate: function(e) {
      return {
        template: Vue.component(Template.name, Template),
        templateArgs: Object.assign({}, e, {
          parentComponent: this.$refs.grid
        })
      };
    }
  }
};
</script>

Regards,
Dimitar
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
K
Top achievements
Rank 1
answered on 16 Jul 2018, 06:48 PM

Got it.

In Kendo UI for jquery data-bind="value:UnitPrice" populates data into a template. how to achieve that in VUE? is the syntax different

0
K
Top achievements
Rank 1
answered on 17 Jul 2018, 12:49 PM

Dimitar,

While you are at it, how to do custom validation on a template? I am not using a form in the custom template

0
Dimitar
Telerik team
answered on 18 Jul 2018, 08:39 AM
Hello,

Data binding with Kendo MVVM is suitable to be used with simple HTML elements. In a Vue project, this could be achieved by using the integrated v-model mechanism. Detailed information on model binding could be found in the following article:


For validation inside the template, you could validate inputs(regardless if nested inside a form or a simple <div>) by adding html attributes as demosntrated on the following CodeSandbox example. Alternatively, you could use the Kendo Validator and manually call the validate() method inside a click handler to trigger custom validation.

Regards,
Dimitar
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Assid
Top achievements
Rank 1
answered on 13 Jan 2020, 07:07 AM

Hi Damir,

I am testing out kendo vue scheduler to see if this component can work for us. I followed the same steps you iterated here, but for the scheduler instead of the grid component. I am able to load the editor with my custom native vue template, all is working as expected except for the 'save' button. When clicked, the onSave function is not triggered, so nothing happens. Is this a bug in the scheduler, when defining a custom edit template? Is there any workaround?

It's weird that 'delete' and 'cancel' are working as expected, but not 'save'. Do you have a working example that you can share? 

Thank you.

0
Dimitar
Telerik team
answered on 13 Jan 2020, 09:30 AM

Hi Assid,

The Kendo Vue Scheduler is a wrapper of the jQuery Scheduler widget which comes with certain limitations in terms of using native vue templates, and more specifically when working with complex widgets such as the Scheduler. In such cases, it is recommended to setup a standard Kendo UI Template as demonstrated in the documentation:

The above limitations could be bypassed with a Native component implementation. We have currently a Native Vue Grid component and are working to expand the suite with additional native components(DropDownList, NumericTextBox and more) for the upcoming release. I would suggest to check the release notes after the official release for additional information.

Regards,
Dimitar
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Assid
Top achievements
Rank 1
answered on 13 Jan 2020, 12:00 PM

Thanks for the quick response, I initially tried to use Kendo UI Template but it was very limited.Our scheduler edit template is too complex and I believe when using kendo ui template,I can't add my custom html code to it.

I hope you solve the 'save' button issue in the future. 

0
Johann
Top achievements
Rank 1
answered on 07 Oct 2020, 04:32 PM

Hi there.

Please see this CodeSandbox for reference: https://codesandbox.io/s/tpi1p

I forked the CodeSandox referenced above to try this out, but I cannot get data entered into a custom Popup Editor to bind/save back to the datasource. If I use a function for the 'read' and 'update' for the transport, I am not seeing in the data property of the event the data entered/selected in the popup editor. Yet, if I do not use a template, the data updates/creates correctly.

What am I missing?

0
Petar
Telerik team
answered on 08 Oct 2020, 02:39 PM

Hi Johann,

Using a Native template inside a Kendo UI for Vue Wrappers component is not supported for complex scenarios like the Grid's popup editor template.  

If you want to use the Kendo UI for Vue Wrappers Grid component, you will have to use Kendo templates for the definition of the popup editor template. If you want to keep the current editor template, you can switch to the Native Grid component

I hope the above information will help you implement the targeted functionality. 

Regards,
Petar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Asked by
K
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
K
Top achievements
Rank 1
Assid
Top achievements
Rank 1
Johann
Top achievements
Rank 1
Petar
Telerik team
Share this question
or