简体   繁体   中英

How to get the dataSource for Kendo toolbar items?

I have kendo toolbar where I have one button for export and on left side of the header I want to add text dynamically from the dataSource but I am not sure how to get data for kendo toolbar items, For columns I know if we add template function that provides the data but for that partticular row. How can I get the data for toolbar so I can display the text that is part of dataSource ?

config.js

toolbar: [
    {
        template: '<button class="btn btn-default k-grid-excel btn-sm pull-right">Export to Excel</button>',
    },
    {
        template:function(dataBound) { 
            console.log("data",dataBound);
            return '<p class="pull-left"><strong>this.dataItem.epcfName</strong></p>'
        }
    }
]

In toolbar component I execute a command like this in console:

$("#toolbar").data("kendoToolBar");

There is no datasource, but I think you will find items in:

$("#toolbar").data("kendoToolBar").options.items;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM