Wijmo UI for the Web
Use an OData Web Service
Show AllShow All
Hide AllHide All

Building on the Quick Start example, you can use the Data module to connect to a general OData web service.

  1. 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 ODataView.
      • Sets the number of records per page to 10 using pageSize.                    
      • Sets the ajax dataType property to jsonp to allow cross-domain requests.
    • Refreshes the data.
    • Sets up the following functions to use in button click events:
      • Filters on Category ID or clears filters.
      • 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.
    • Binds the ViewModel to the container.

    Drop down and copy code

  2. 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

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

See Also

Reference

Data

 
Support Options