numbers - dojo empty numbertextbox is displaying NaN , but I dont want either defualt value to it -
i have numbertextbox in datagrid editable. if empty, displaying nan, don't want either default value .
should such (blank). please, me. how can achieve in dojo?
try setting contraints parameter this:
var mynumberbox = new dijit.form.numbertextbox({ constraints: { pattern: "0.####" }, // pattern number displayed or set value: "", // starting value if value isn't set other source required: false, // may want set true if user input required placeholder: "(blank)" // shown when no value present });
whenever value of number box, may want pass through parseint(value) or parsefloat(value) first. check if it's number.
var value = parsefloat(mynumberbox.get("value")); if ( isnan(value) ) { // code handle if nan }
for more help, go link.
i hope helps.
Comments
Post a Comment