I am trying create a new custom widget based on this tutorial.
I came this far:
It works in case where I manually set kendoMyTextBox, but not where I use data-role attribute.
It would be also nice if someone help me with providing code, how can I set value attribute for value. I get undefined is not a function in line
if I write
I don't know if I need to write some code in refresh or not?
And for the last: Why is preferred way to use that (instead of this) when creating custom widget.
I came this far:
var MyTextbox = kendo.ui.Widget.extend( { init: function (element, options) { kendo.ui.Widget.fn.init.call(this, element, options); $(element).css("border-color", "#FF0000"); }, options: { name: "MyTextbox", }, events: ["dataBinding", "dataBound"], refresh: function() { var that = this; that.trigger("dataBinding"); that.trigger("dataBound"); } }); kendo.ui.plugin(MyTextbox); </script></head><body> <input data-role="MyTextbox" /> <input id="MyTextbox" /> <script> $(document).ready(function() { $("#MyTextbox").kendoMyTextbox(); }); </script></body></html>It would be also nice if someone help me with providing code, how can I set value attribute for value. I get undefined is not a function in line
kendo.bind($(document.body), MVVM);<input data-role="MyTextbox" data-bind="value: valuerole" />And for the last: Why is preferred way to use that (instead of this) when creating custom widget.