Hi,
Is there a way to instantiate a blank NumericTextBox when editting a "Number" field who's value is 0?
In other words, if I have numeric fields in my grid and their value is 0, I want to show the 0 on the grid. And when the user edits the field, I'd like to a NumericTextBox to show with no value. If the user does not give a new value, and 'blurs' the text box, the underlying value in the text box does not change.
Currently, when I edit a number who's value is 0 or null, the 0 shows in the text box. I just think it would be a better user experience if the 0 disappeared when editing the value.
Here is my attempt at such an editor. This is not working since this code will change the datasource value to null if textbox is left blank, which triggers the grid save event, and a whole host of other things.
$('<input class="text-right" name="' + options.field + '"/>')
.appendTo(container)
.kendoNumericTextBox({
decimals: 0,
format: 'n0',
step: 1,
spinners: false
}).off("keydown").on({
'focus': function () {
if (!$(this).val() == 0) {
$(this).val('');
console.log('huh?', this.value, $(this).val(), arguments);
}
},
'blur': function () {
if ($(this).val() == "") {
console.log('wha?', this.value);
$(this).val("0");
}
}
});