The _wrapper method in the NumericTextbox looks like it has a bug where there is unreachable code, if the NumericTextbox
has been loaded previously.
Looking at the source and comparing it to the DatePicker source, which I know works, I can see the problem.
The source for DatePicker has this definition:
The source for NumericTextbox has this definition:
You may note that it only looks at the direct parent for the wrapper, when in fact the wrapper is on it's second parent, as indicated by last half of the code.
Also this bug may be replicated on http://demos.kendoui.com/web/numerictextbox/index.html by simply rerunning the command through a browser console
If the code is supposed to be rerun-able then it should look similar to the following:
Now I don't know if the Kendo UI elements are all supposed to be rerun-able or not, I will post a separate thread about that as that is a more generic conversation.
has been loaded previously.
Looking at the source and comparing it to the DatePicker source, which I know works, I can see the problem.
The source for DatePicker has this definition:
_wrapper:
function
() {
var
that =
this
,
element = that.element,
wrapper;
wrapper = element.parents(
".k-datepicker"
);
if
(!wrapper[0]) {
wrapper = element.wrap(SPAN).parent().addClass(
"k-picker-wrap k-state-default"
);
wrapper = wrapper.wrap(SPAN).parent();
}
wrapper[0].style.cssText = element[0].style.cssText;
element.css({
width:
"100%"
,
height:
"auto"
});
that.wrapper = wrapper.addClass(
"k-widget k-datepicker k-header"
);
that._inputWrapper = $(wrapper[0].firstChild);
}
The source for NumericTextbox has this definition:
_wrapper:
function
() {
var
that =
this
,
element = that.element,
wrapper;
wrapper = element.parent();
if
(!wrapper.is(
"span.k-widget"
)) {
wrapper = element.hide().wrap(
'<span class="k-numeric-wrap k-state-default" />'
).parent();
wrapper = wrapper.wrap(
"<span/>"
).parent();
}
wrapper[0].style.cssText = element[0].style.cssText;
that.wrapper = wrapper.addClass(
"k-widget k-numerictextbox"
).show();
that._inputWrapper = $(wrapper[0].firstChild);
}
You may note that it only looks at the direct parent for the wrapper, when in fact the wrapper is on it's second parent, as indicated by last half of the code.
Also this bug may be replicated on http://demos.kendoui.com/web/numerictextbox/index.html by simply rerunning the command through a browser console
$(
"#numeric"
).kendoNumericTextBox();
If the code is supposed to be rerun-able then it should look similar to the following:
wrapper = element.parents(
'.k-numerictextbox'
);
if
(!wrapper.is(
".k-numerictextbox"
)) {
wrapper = element.hide().wrap(
'<span class="k-numeric-wrap k-state-default" />'
).parent();
wrapper = wrapper.wrap(
"<span/>"
).parent();
}
Now I don't know if the Kendo UI elements are all supposed to be rerun-able or not, I will post a separate thread about that as that is a more generic conversation.