I am trying to create a kendo custom widget in typescript, but the data function always returns null.
let emptyWidget = $(
'#emptyCriteria'
).kendoEmptyTemplate().data(
'kendoEmptyTemplate'
);
console.log(emptyWidget)
// getting always undefined
Widget Code:
interface JQuery {
kendoEmptyTemplate(options?: KendoWidgets.IEmptyTemplateOptions): JQuery;
data(key:
"kendoEmptyTemplate"
): KendoWidgets.EmptyTemplateOptions;
}
module KendoWidgets {
export interface IEmptyTemplateOptions {
}
export class EmptyTemplateOptions implements IEmptyTemplateOptions{
name: string =
'EmptyTemplate'
;
}
export class EmptyTemplate extends kendo.ui.Widget
{
options: EmptyTemplateOptions;
constructor(element: Element, options: IEmptyTemplateOptions) {
super
(element, options);
}
}
// Create an alias of the prototype (required by kendo.ui.plugin)
EmptyTemplate.fn = EmptyTemplate.prototype;
// Deep clone the widget default options
EmptyTemplate.fn.options =
new
EmptyTemplateOptions();
// Create a jQuery plugin.
kendo.ui.plugin(EmptyTemplate);
}
Html:
<
div
id
=
"emptyCriteria"
></
div
>
Any of you have encountered this issue or am I missing any methods in widget?