My code is:
The important line is: data-uid="#= data.uid #
If the user (programmer) defines template without uid, the Widget will not work as expected.
How can I check if user define template with data-uid, or not? How can I added it, if not exists?
var MatjazChooser = kendo.ui.Widget.extend({
init: function(element, options) {
var that = this;
kendo.ui.Widget.fn.init.call(that, element, options);
that.wrapper = that.element;
element = that.element;
element.addClass('k-chooser');
var template = that.options.template;
if (template == "")
{
template = '<
span
class
=
"k-button"
data-group
=
"# if (data.group != undefined) { ##=data.group##} else {#default#}#"
data-uid
=
"#= data.uid #"
>';
template += '# if (data.imageUrl != undefined) { #';
template += '<
img
src
=
"#= data.imageUrl #"
><
br
>';
template += '#}#';
template += '#= text #';
template += '</
span
>';
}
that.template = kendo.template(template);
that._dataSource();
},
If the user (programmer) defines template without uid, the Widget will not work as expected.
How can I check if user define template with data-uid, or not? How can I added it, if not exists?