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

Kendo ui grid template parameters

1 Answer 121 Views
This is a migrated thread and some comments may be shown as answers.
Davood
Top achievements
Rank 1
Davood asked on 20 Jan 2019, 05:02 PM

Hi,

Is it possible to pass another parameter with event to methods?

my code is as below:

<kendo-grid-column
            field="UnloadingID"
            title="Unloading"
            :template="getLayerName(shapes,event)"
          ></kendo-grid-column>

 

and method is: (shapes is in my data)

getLayerName: function (shapes,e) {

console.log(e,shapes);

}

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 23 Jan 2019, 06:31 AM
Hello Davood,

In general, the <kendo-grid-column> template prop can be specified as a function and you should be able to pass parameters such as 'shapes' that is defined in the Vue data. However, a cleaner approach would be to use Single-FIle Components. This is demonstrated in the following section of the documentation:


With the approach demonstrated in the above article, you should be able to pass any required metadata to the template in its arguments as follows:
<script>
import Template from "./ItemTemplate.vue";
import Vue from "vue";
 
export default {
   name: "HelloWorld",
   data() {
       return {
           localDataSource: {
               data: [
                   { title: "title 1", num: 1, numTwo: 2, total: 3, id: 1 },
                   { title: "title 2", num: 1, numTwo: 2, total: 3, id: 2 }
               ]
           }
       };
   },
   methods: {
       itemTemplate: function(e) {
           return {
               template: Vue.component(Template.name, Template),
               templateArgs: Object.assign({}, e, {
                   parentComponent: this.$refs.ddl
               })
           };
       }
   }
};
</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
Asked by
Davood
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or