API Documentation

DataSource

Full featured jQuery compatible Data Source component. For examples, check out DataSource demo page.

Properties

Key Type Required Description
autoLoad boolean No Defaults to false
data array No Defaults to empty array
dataType string No Defaults to array. Possible values are: array, json and xml
dataUrl string No Defaults to null
fields array No Defaults to empty array
filter array No Defaults to empty array. Array of objects. Object indexes are:
field - field name
operator - lt, lte, le, gt, gte, ge, eq, neq, ne, start, end
value - value to compare against
page number No Defaults to 1
rowCount numeric No Defaults to 20
sort array No Defaults to empty array. Array of object. Object indexes are:
field - field name
direction - ASC, DESC
xmlRecord string No Defaults to null
xmlRoot string No Defaults to null

Methods

Method Arguments Description
add .add(item) Add data item to the dataset.
cancel .cancel() Cancel all the changes made by add, insert, remove and return original dataset.
data .data() Get data.
.data([{name: "Douglas Crockford"},{name: "John Resig"}]) Set data with an array of objects.
filter .filter() Get or set filtering rules.
getById .getById(zuid) Return data item by given id.
getByIndex .getByIndex(index) Return data item by given index.
insert .insert(index, item) Insert data item at specified index.
load .load(callback) Load data from server and fire given callback.
page .page() Get or set current page.
.page(num)
pages .pages() Return number of pages.
refresh .refresh() Fire the callback defined at load method.
remove .remove(item) Remove data item from dataset.
rowCount .rowCount() Get or set number of data items per page.
.rowCount(num)
sort .sort() Get or set sorting conditions.
.sort([{field: "name", direction: "ASC"},{field: "age", direction: "DESC"}])
total .total() Return number of total data items.

Events

Event Arguments Description
change event, ui Fires when data loads or cancel all changes.