Wijmo UI for the Web
Integrate Breeze.js
Show AllShow All
Hide AllHide All

You can use the Data module to integrate Breeze.js into your application. Using the BreezeDataView Class, set up a Breeze DataService and bind the wijmo.data module to it. In this sample, we use a Breeze.js EntityQuery to fetch the data.

  1. In Notepad, create a new HTML page, add the following code and save the document with an .html extension.

    Drop down and copy markup to paste in Notepad

  2. Add links to the dependencies, KnockOut, and Breeze to your HTML page within the <head> tags. Find the latest dependencies in the content delivery network (CDN) file at wijmo cdn.

    Drop down and copy references to paste inside the head tags

  3. In the <head> section of your HTML file, replace the script that includes the document ready function with this one, which does the following:
    • Creates a ViewModel with the following properties:
      • Connects to a data source using the Breeze DataService.
      • Sets up the MetadataStore, adding one EntityType for the Product table, and four properties.
      • Sets up an EntityManager for the DataService and MetadataStore.
      • Sets the number of records per page to 10 with the pageSize option.                    
      • Sets the inlineCount option to true.
    • Refreshes the data.
    • Sets up the following functions to use in button click events:
      • Filters by Category ID.
      • Sorts on Product ID or Price.
      • Sets the number of products per page to 10, or clears paging to show all (0).
      • Goes to the previous or next page.
      • Adds or deletes a product and commits the change to the data source.
      • Doubles the price of the selected item.
    • Binds the ViewModel to the container using Knockout.
    • Loads, or if unavailable, creates a new Session ID.

    Drop down and copy code

  4. In the <body> section of your HTML file, replace the markup with this, which does the following:
    • Creates a table with buttons and binds the button click events to the functions in the script.
    • Creates a second table with a Grid widget, and binds the data to it.

    Drop down and copy code

  5. Save your HTML file and open it in a browser. The grid appears like the live widget below.

See Also

Concepts

Reference

 
Support Options