Number
Number formatting controls what a cell displays. Editing, parsing, validation, precision, and units are separate decisions. Keep the source numeric for numeric sorting, filtering, formulas, and aggregation; do not replace 1234.5 with the text "1,234.50".
1. Choose your implementation
Section titled “1. Choose your implementation”| Need | Use | Dependency |
|---|---|---|
| Locale-aware numeric entry with precision, bounds and stepping | Number Editor, Currency Editor, Percentage Editor | Pro |
| Fixed masks for numeric codes and identifiers | Masked Editor | Pro |
| A localized display and optional Format Cells dialog | column.dataGridFormat | Pro DataGridFormattingPlugin |
| An editable numeric column with Numeral masks | NumberColumnType | Optional @revolist/revogrid-column-numeral; no Pro required |
| Compact, engineering, or unit display with full Intl options | cellTemplate and Intl.NumberFormat | Core; your app supplies an editor if needed |
| Bounded quantities or a visual input | Counter or Slider | Pro |
A format does not automatically install a numeric editor or parse country-specific input. Start with editing and validation for writable columns.
2. Install formatting once
Section titled “2. Install formatting once”For the Pro recipes below, assume an existing <revo-grid> and this setup:
import { DataGridFormattingPlugin } from '@revolist/revogrid-pro';
const grid = document.querySelector('revo-grid')!;grid.plugins = [DataGridFormattingPlugin];grid.source = [{ amount: 1234.5 }];grid.columns = [{ prop: 'amount', name: 'Amount', dataGridFormat: { value: { kind: 'preset', preset: 'number', locale: 'en-US', decimalPlaces: 2 }, },}];Merge this plugin into your existing plugin list. The value remains 1234.5; the display is 1,234.50. Right-click a cell and choose Format → More formats… for the interactive dialog. For Core-only usage, skip this setup and follow the standalone Numeral or Intl recipes.
3. Editors
Section titled “3. Editors”Choose an input control for editable cells.
| Page | Examples and application |
|---|---|
| Number Editor | Localized input, precision, bounds, stepping and required values |
| Currency Editor | Currency amounts and locale-aware entry |
| Percentage Editor | Percentage input with ratio storage |
| Masked Editor | Codes, phone numbers, escaped literals and leading zeros |
| Numeral editor and masks | Standalone numeric column with Numeral masks |
| Counter | Increment and decrement bounded quantities |
| Slider | Adjust a numeric value visually |
4. Formatting & guides
Section titled “4. Formatting & guides”Choose how numbers display, then define their storage and validation rules.
| Page | Examples and application |
|---|---|
| Integers and decimals | Stock counts, decimal quantities, fixed precision, blanks |
| Currency and accounting | Invoices, negative balances, mixed currencies, rounding |
| Percentages and rates | BI conversion rates, percentage points, basis points |
| Countries and locales | US, Europe, India, Arabic digits; input contracts |
| Scientific, compact, and units | Research, engineering, dashboards, measurements |
| Spreadsheet format codes | Fractions, scaling, zero padding, conditions and literals |
| Time and duration | Elapsed hours, clock time, time zones and date serials |
| Rounding, precision, and signs | Cash-style increments, significant digits, plus/minus policies |
| Editing and validation | Save numeric values, enforce ranges, reject invalid input |
5. Keep downstream behavior consistent
Section titled “5. Keep downstream behavior consistent”Declare numeric units in your field contract: currency code, major/minor units, fraction/percent, seconds/days. Aggregate raw values before formatting. A ratio KPI usually needs sum(numerator) / sum(denominator), rather than an average of displayed percentages.
For numeric conditions see Number Filter. For workbook output see Excel cell formatting: a display-only template does not automatically define a native Excel number format. For format precedence, reactive presets, custom editors and exact format-code support, see Format Cells.