dojo empty numbertextbox正在显示NaN,但我不希望对其使用任何一个解模糊值

dojo empty numbertextbox正在显示NaN,但我不希望对其使用任何一个解模糊值,dojo,numbers,dojox.grid.datagrid,Dojo,Numbers,Dojox.grid.datagrid,我在Datagrid中有一个可编辑的numbertextbox。如果为空,则显示NaN,但我不希望为其设置任何默认值。 它应该是这样的(空白)。请帮帮我。如何在dojo中实现这一点?尝试如下设置CONTAINTS参数: var myNumberBox = new dijit.form.NumberTextBox({ constraints: { pattern: "0.####" }, // The pattern that the number will be displayed o

我在Datagrid中有一个可编辑的numbertextbox。如果为空,则显示NaN,但我不希望为其设置任何默认值。

它应该是这样的(空白)。请帮帮我。如何在dojo中实现这一点?

尝试如下设置CONTAINTS参数:

var myNumberBox = new dijit.form.NumberTextBox({
    constraints: { pattern: "0.####" },  // The pattern that the number will be displayed or set as
    value: "",       // The starting value if a value isn't set from any other source
    required: false, // You may want to set this to true if user input is required
    placeHolder: "(blank)" // What is shown when no value is present
});
无论何时获得数字框的值,您可能希望首先通过parseInt(值)或parseFloat(值)传递它。还要检查它是否是一个数字

var value = parseFloat(myNumberBox.get("value"));
if ( isNan(value) ) {
    // Code to handle if it is NaN
}
要获得更多帮助,请转到此

我希望这有帮助