|
|
@ -10,6 +10,9 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
valueFormatter: function (v) { |
|
|
|
valueFormatter: function (v) { |
|
|
|
return v; |
|
|
|
return v; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
valueParser: function (v) { |
|
|
|
|
|
|
|
return v; |
|
|
|
|
|
|
|
}, |
|
|
|
value: 0, |
|
|
|
value: 0, |
|
|
|
allowBlank: false, |
|
|
|
allowBlank: false, |
|
|
|
errorText: "", |
|
|
|
errorText: "", |
|
|
@ -38,6 +41,10 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
errorText: o.errorText |
|
|
|
errorText: o.errorText |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { |
|
|
|
this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { |
|
|
|
|
|
|
|
// 大多数时候valueFormatter往往需要配合valueParser一起使用
|
|
|
|
|
|
|
|
var value = this.getValue(); |
|
|
|
|
|
|
|
var parsedValue = o.valueParser(value); |
|
|
|
|
|
|
|
this.setValue(o.valueFormatter(parsedValue)); |
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); |
|
|
|
self.fireEvent(BI.NumberEditor.EVENT_CHANGE); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.on(BI.TextEditor.EVENT_ERROR, function () { |
|
|
|
this.editor.on(BI.TextEditor.EVENT_ERROR, function () { |
|
|
@ -57,6 +64,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
type: "bi.icon_button", |
|
|
|
type: "bi.icon_button", |
|
|
|
forceNotSelected: true, |
|
|
|
forceNotSelected: true, |
|
|
|
trigger: "lclick,", |
|
|
|
trigger: "lclick,", |
|
|
|
|
|
|
|
debounce: false, |
|
|
|
cls: (o.simple ? "solid-triangle-top-font " : "add-up-font bi-border-left ") + "top-button bi-list-item-active2 icon-size-12" |
|
|
|
cls: (o.simple ? "solid-triangle-top-font " : "add-up-font bi-border-left ") + "top-button bi-list-item-active2 icon-size-12" |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
@ -68,6 +76,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
type: "bi.icon_button", |
|
|
|
type: "bi.icon_button", |
|
|
|
trigger: "lclick,", |
|
|
|
trigger: "lclick,", |
|
|
|
forceNotSelected: true, |
|
|
|
forceNotSelected: true, |
|
|
|
|
|
|
|
debounce: false, |
|
|
|
cls: (o.simple ? "solid-triangle-bottom-font " : "minus-down-font bi-border-left ") + "bottom-button bi-list-item-active2 icon-size-12" |
|
|
|
cls: (o.simple ? "solid-triangle-bottom-font " : "minus-down-font bi-border-left ") + "bottom-button bi-list-item-active2 icon-size-12" |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
|
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
|
|
@ -154,4 +163,4 @@ BI.NumberEditor = BI.inherit(BI.Widget, { |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.NumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
BI.NumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
BI.NumberEditor.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
BI.NumberEditor.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
BI.shortcut("bi.number_editor", BI.NumberEditor); |
|
|
|
BI.shortcut("bi.number_editor", BI.NumberEditor); |
|
|
|