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
  • Creating an Extension
  • Methods
  • Custom Property

Was this helpful?

  1. Working With Queries
  2. Select Queries

Query Extensions

PreviousSelect QueriesNextStored Procedures

Last updated 1 year ago

Was this helpful?

Query extensions are methods added to that are specific to a .

Creating an Extension

To create an extension, override the base wire.data.select function and then add methods to the new version.

wire.data.select = function () {

    let self = select.apply(null, arguments);        
    
    self.myMethod = function(){
        ///
    }
}

Methods

Query extensions can be used for a variety of operations specific to a data connector.

Here, a method is used to wrap a category filter on a specific value.

wire.data.select = function () {
    ...
    self.category = function(value){              
        return self.eq("category", value);
    }
}

This new method can now be used to create a standard query.

const query = wire.data.select().from("product").category("apples");

Custom Property

wire.data.select = function () {
    ...
    self.facet = function(field){              

        self.Custom = self.Custom || {};

        self.Custom.facets = self.Custom.facets || [];

        self.Custom.facets.push(field);
        
        return this;

    }    
}

Query extensions can also be used to pass custom data to a data connector. Use the Custom property on the class inside the extension method to pass custom data to a data connector.

The following example is a short/modified version of a method taken from the search query extension.

standard WireBootstrap select queries
data connector
TableQuery
WireBootstrap for Azure