Giter Club home page Giter Club logo

jquery.datatables.odata's Introduction

#jQuery DataTables OData connector

jQuery DataTables OData connector enables standard jQuery DataTables plugin to display data provided by OData service. Beside displaying, it allows you to filter, sort, and navigate through the data. There are several versions of OData services (v4, v3, and v2), which return results in different formats. This connector handles all of these versions (and you simply need to specify a version through "iODataVersion" parameter).

Setup

Steps:

  • Setup jQuery dataTables as you would usually do,
  • On top of that include jquery.datatables.odata.js file in your page,
  • Specify location ("sAjaxSource") and version ("iODataVersion") of OData service, and
  • Set value of "fnServerData" parameter to "fnServerOData"

Example:

$('table#products').dataTable({
	"sAjaxSource": "http://services.odata.org/V4/OData/OData.svc/Products",
	"iODataVersion": 4,
	"aoColumns": [
		{ mData: "Name" },
		{ mData: "Description" },
		{ mData: "Rating", sType: 'numeric' },
		{ mData: "Price", sType: 'numeric' },
		{ sName: "ReleaseDate", sType: 'date' }
	],
	"fnServerData": fnServerOData, // required
	"bServerSide": true,  // optional
	"bUseODataViaJSONP": true,	// set to true if using cross-domain requests
});

Note: For full example take a look at submitted html pages.

Functionality for connecting to OData service is placed in the fnServerOData function defined in jquery.datatables.odata.js. This function should be set as the value of "fnServerData" parameter.

If dataTables is used in server-side processing mode, date columns and numeric columns should be marked as such using "sType" parameter (because OData service cannot perform text search against these fields). Also, for cross-domain requests you need to set "bUseODataViaJSONP" parameter value to true.

jquery.datatables.odata's People

Contributors

jocapc avatar hartez avatar alexkeysmith avatar

Watchers

zgldh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.