InputNumber

The InputNumber control is a simple input control that only allows users to enter and edit numbers. The values entered can be formatted or limited to a specific range.

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import * as input from '@grapecity/wijmo.input'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { // a regular input number let theNumber = new input.InputNumber('#theNumber', { valueChanged: (sender) => { document.querySelector('#theNumberOutput').textContent = sender.value.toString(); } }); // // you can clear this one let theNumberNotRequired = new input.InputNumber('#theNumberNotRequired', { isRequired: false, value: null, min: 0, max: 100, placeholder: 'Your age (optional)' }); } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity InputNumber</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div class="container-fluid"> <p> For example, here is an InputNumber with default settings: </p> <div class="form-group"> <label for="theNumber">InputNumber</label> <input id="theNumber"> </div> <div> The current value is <b><span id="theNumberOutput">0</span></b>. </div> <hr /> <p> By default, InputNumber values are required, so you can't delete the entire content of the control. If you want to enter a number that is optional, set the <b>isRequired</b> property to false: </p> <div class="form-group"> <label for="theNumberNotRequired">Not Required</label> <input id="theNumberNotRequired"> </div> </div> </body> </html> label { width: 100px; text-align: right; margin-right: 3px; } body { margin-bottom: 36px; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import { Component, enableProdMode, NgModule } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjInputModule } from '@grapecity/wijmo.angular2.input'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { } // @NgModule({ imports: [WjInputModule, BrowserModule], declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } // enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity InputNumber</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Polyfills --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html> <div class="container-fluid"> <p> For example, here is an InputNumber with default settings: </p> <div class="form-group"> <label for="theNumber">InputNumber</label> <wj-input-number #theNumber id="theNumber"></wj-input-number> </div> <div> The current value is <b>{{ theNumber.value }}</b>. </div> <hr /> <p> By default, InputNumber values are required, so you can't delete the entire content of the control. If you want to enter a number that is optional, set the <b>isRequired</b> property to false: </p> <div class="form-group"> <label for="theNumberNotRequired">Not Required</label> <wj-input-number id="theNumberNotRequired" [isRequired]="false" [value]="null" [min]="0" [max]="100" [placeholder]="'Your age (optional)'"></wj-input-number> </div> </div> label { width: 100px; text-align: right; margin-right: 3px; } body { margin-bottom: 36px; } <template> <div class="container-fluid"> <p> For example, here is an InputNumber with default settings: </p> <div class="form-group"> <label for="theNumber">InputNumber</label> <wj-input-number id="theNumber" :initialized="initNumber"></wj-input-number> </div> <div> The current value is <b>{{ theNumber.value }}</b>. </div> <hr /> <p> By default, InputNumber values are required, so you can't delete the entire content of the control. If you want to enter a number that is optional, set the <b>isRequired</b> property to false: </p> <div class="form-group"> <label for="theNumberNotRequired">Not Required</label> <wj-input-number id="theNumberNotRequired" :isRequired=false :value=null :min=0 :max=100 placeholder="Your age (optional)"></wj-input-number> </div> </div> </template> <script> import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import Vue from 'vue'; import '@grapecity/wijmo.vue2.core'; import '@grapecity/wijmo.vue2.input'; let App = Vue.extend({ name: 'app', data: function(){ return { theNumber: {} } }, methods:{ initNumber: function(number){ this.theNumber = number; } } }) let vm = new Vue({ render: h => h(App) }).$mount('#app'); </script> <style> label { width: 100px; text-align: right; margin-right: 3px; } body { margin-bottom: 36px; } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity InputNumber</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); </script> </head> <body> <div id="app"></div> </body> </html> import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './app.css'; // import * as React from 'react'; import * as ReactDOM from 'react-dom'; import * as wjInput from '@grapecity/wijmo.react.input'; // class App extends React.Component { constructor(props) { super(props); this.state = { value: null }; } render() { return <div className="container-fluid"> <p> For example, here is an InputNumber with default settings: </p> <div className="form-group"> <label htmlFor="theNumber">InputNumber</label> <wjInput.InputNumber id="theNumber" initialized={this._initNumber.bind(this)} valueChanged={this._onValueChanged.bind(this)}> </wjInput.InputNumber> </div> <div> The current value is <b>{this.state.value}</b>. </div> <hr /> <p> By default, InputNumber values are required, so you can't delete the entire content of the control. If you want to enter a number that is optional, set the <b>isRequired</b> property to false: </p> <div className="form-group"> <label htmlFor="theNumberNotRequired">Not Required</label> <wjInput.InputNumber id="theNumberNotRequired" isRequired={false} value={null} min={0} max={100} placeholder="Your age (optional)"> </wjInput.InputNumber> </div> </div>; } _initNumber(sender) { this.setState({ value: sender.value }); } _onValueChanged(sender) { this.setState({ value: sender.value }); } } ReactDOM.render(<App />, document.getElementById('app')); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>AutoComplete</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div id="app"></div> </body> </html> label { width: 100px; text-align: right; margin-right: 3px; } body { margin-bottom: 36px; }