Files
hustoj/web/bsadmin/assets/js/lib/jsgrid/fields/jsgrid.field.number.js
2024-10-10 12:56:56 +08:00

42 lines
1.0 KiB
JavaScript

(function(jsGrid, $, undefined) {
var TextField = jsGrid.TextField;
function NumberField(config) {
TextField.call(this, config);
}
NumberField.prototype = new TextField({
sorter: "number",
align: "right",
readOnly: false,
filterValue: function() {
return this.filterControl.val()
? parseInt(this.filterControl.val() || 0, 10)
: undefined;
},
insertValue: function() {
return this.insertControl.val()
? parseInt(this.insertControl.val() || 0, 10)
: undefined;
},
editValue: function() {
return this.editControl.val()
? parseInt(this.editControl.val() || 0, 10)
: undefined;
},
_createTextBox: function() {
return $("<input>").attr("type", "number")
.prop("readonly", !!this.readOnly);
}
});
jsGrid.fields.number = jsGrid.NumberField = NumberField;
}(jsGrid, jQuery));