WireBootstrap
HomeDocsBuySupport
  • Introduction
  • Overview
  • Getting Started
  • Installation
  • Connecting to Data
    • Data Connectors
      • SQL Data
      • Custom Web Services
      • Local Data
      • Other Sources
    • Data Sources
    • Discovery
    • Building a Data Connector
  • Working With Queries
    • Select Queries
      • Query Extensions
    • Stored Procedures
    • Custom Web Services
    • Executing Queries
    • ORM
  • Writing Data
  • Updates
  • Deletes
  • Working with DataTables
    • Introduction
    • Filter and Sort
    • Select and Calculate
    • Joins
    • Rows
    • Columns
  • Working with DataSets
  • Introduction
  • Executing Queries
  • Transforms
  • Writing Data
  • Data Events
  • Working with Components
    • Introduction
    • Encapsulation
    • Configuration
      • Data
      • Events
      • Observables
      • Validation
      • Display
      • Vendor
      • Custom
    • Component
    • Web Frameworks
    • Building a Component
      • Hello World
      • Data Events
      • DataSets
  • Working With Data Events
    • Introduction
    • Event Basics
    • Event Data
    • Event Actions
  • Working with Themes
    • Introduction
    • Sample Data
    • Libraries
    • Pages
    • Building a Theme Project
  • Utilities
    • Formatting
    • Expressions
    • Collections
    • Spinners
    • Copy and Merge
    • Validation
    • Loading Assets
    • Service Calls
    • Download Files
    • Browser Location
    • Types
    • Promise
  • Reference
    • wire
      • wire.Collection
      • wire.download
      • wire.validate
    • wire.data
      • wire.data.DataEvent
      • wire.data.DataModel
      • wire.data.DataPromise
      • wire.data.DataSet
      • wire.data.DataSource
      • wire.data.DataTable
        • Columns
        • Rows
      • wire.data.StoredProcedure
      • wire.data.TableQuery
    • wire.ui
      • wire.ui.Component
      • wire.ui.validate
Powered by GitBook
On this page
  • String Formatting
  • Number Formatting
  • Custom Formatting

Was this helpful?

  1. Utilities

Formatting

PreviousBuilding a Theme ProjectNextExpressions

Last updated 3 years ago

Was this helpful?

WireBootstrap provides a number of options for string, numeric, and other type formatting.

String Formatting

WireBootstrap adds a string extension called format that allows variables inside a string expression to be replaced by values. The variables are expressed using the numeric index position of the variables within the string in curly brackets {}.

const str = "Use this {0} to format {1}".format("expression", "strings");

// Use this expression to format strings

Number Formatting

Numeric values can be formatted using the format method with a format specification. Valid values are C[N], P[N], N[N] where [N] is the number of decimal places.

The example below sets the formatting for a number to one decimal place using the N1 parameter in the format function.

const currencyFormat = wire.format(10000.12, "N1");

// currencyFormat = 10,000.1

Custom Formatting

The format method can also accept a custom function in order to format data.

The following example formats a date field called date_field using the third party library .

const dte = wire.format("1980-10-10", (row) => {
    return moment(row["date_field"]).format("MM-DD-YYYY");
});

For more on formatting, visit the reference page.

moment.js
core wire