\Hazaar\View\Widgets
DataAdapter
The jqWidgets dataAdapter wrapper class

This class wraps the functionality and parameters available by a jqx.dataAdapter class. It will correctly format the source and settings arguments using JSONObject type classes. The data source used in the constructor should be an object of type \\Hazaar\\Widgets\\DataSource

This class is quite involved when it comes to advanced usage. For details on how to use the advanced features of this class, refer to the jqWidgets documentation at http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdataadapter/jquery-data-adapter.htm

Tags

Since

1.1

Summary
Methods Properties Constants
No constants
Properties
Static
$count
$count
$name
$name
$rendered
$rendered
$settings
$settings
$source
$source
Methods
__construct()
__construct($source, $settings = null)

DataAdapter Constructor

Tags

Since

1.1

Parameters

$source\Hazaar\View\Widgets\Hazaar\View\Widgets\DataSource

The data source object used to define the location of the data.

$settingsarray

Optional settings to set on the DataAdapter that influence it’s function.

async()
async($value = true) : Hazaar\\Widgets\\DataAdapter

By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. When the binding is “asynchronous”, the data binding operation occurs in parallel and the order of completion is not guaranteed.

Tags

Since

1.1

Parameters

$value\Hazaar\View\Widgets\bool

False will turn off asynchronous mode.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
autoBind()
autoBind($value = true) : Hazaar\\Widgets\\DataAdapter

Enabled/disable automatic data binding.

Tags

Since

1.1

Parameters

$value\Hazaar\View\Widgets\bool

Specify whether autobind is active or not. Default: true.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
beforeLoadComplete()
beforeLoadComplete($func) : Hazaar\\Widgets\\DataAdapter

A callback function which is called before the data is fully loaded. The function gets passed two arguments: The loaded records. The second argument is the original data. If the function returns an array, the dataAdapter’s records field will be set to it.

Tags

Since

1.1

Parameters

$funcmixed

JavaScript function code as either a string or a JavaScript object.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
beforeSend()
beforeSend($func) : Hazaar\\Widgets\\DataAdapter

A pre-request callback function that can be used to modify the jqXHR.

Provides: function($jqXHR, $settings)

Tags

Since

1.1

Parameters

$funcmixed

JavaScript function code as either a string or a JavaScript object.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
beginUpdate()
beginUpdate() : string

Begins data update operation. If you need to update multiple records at once, call this method before the update.

Tags

Since

1.1

Returns

string
contentType()
contentType($value) : Hazaar\\Widgets\\DataAdapter

Use this option, If you want to explicitly pass in a content-type. Default is “application/x-www-form-urlencoded”.

Tags

Since

1.1

Parameters

$valuestring

The content type you want to set.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
dataBind()
dataBind() : string

Performs data binding.

Tags

Since

1.1

Returns

string
downloadComplete()
downloadComplete($func) : Hazaar\\Widgets\\DataAdapter

A callback function which is called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR.

Provides: function($edata, $textStatus, $jqXHR)

Tags

Since

1.1

Parameters

$funcmixed

JavaScript function code as either a string or a JavaScript object.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
endUpdate()
endUpdate($refresh = true) : string

ends the data update operation. Performs data refresh by default, if you call the method without params or with true parameter.

Tags

Since

1.1

Parameters

$refresh

No description

Returns

string
formatData()
formatData($func) : Hazaar\\Widgets\\DataAdapter

A callback function which is called before the data is sent to the server. You can use it to fully override the data sent to the server. If you define a ‘formatData’ function, the result that the function returns will be sent to the server.

Tags

Since

1.1

Parameters

$funcmixed

JavaScript function code as either a string or a JavaScript object.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
getAggregatedData()
getAggregatedData($fields, $object = null, $records = null) : string

gets an array of aggregated data.

Tags

Since

1.1

Parameters

$fields

No description

$object

No description

$records

No description

Returns

string
getGroupedRecords()
getGroupedRecords($groupedFields, $collection, $name, $map) : string

Gets the array of the loaded data records and groups them. The method has 4 parameters. The first parameter is an array of grouping fields. The second parameter is the sub items collection name. The third parameter is the group’s name. The last parameter specifies the mapping between the Data Source fields and custom data fields.

Tags

Since

1.1

Parameters

$groupedFieldsarray

No description

$collectionstring

No description

$namestring

No description

$mapstring

No description

Returns

string
getRecordsHierarchy()
getRecordsHierarchy($id, $parent, $collection = null, $map = null) : string

gets the array of the loaded data records and builds a data tree. The method has 4 parameters, the last 2 of which are optional. The first parameter is the field’s id. The second parameter represents the parent field’s id. These parameters should point to a valid ‘datafield’ from the Data Source. The third parameter which is optional specifies the name of the ‘children’ collection. The last parameter specifies the mapping between the Data Source fields and custom data fields.

Tags

Since

1.1

Parameters

$id

No description

$parent

No description

$collection

No description

$map

No description

Returns

string
loadComplete()
loadComplete($func) : Hazaar\\Widgets\\DataAdapter

A callback function which is called when the data is fully loaded.

Tags

Since

1.1

Parameters

$funcmixed

JavaScript function code as either a string or a JavaScript object.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
loadError()
loadError($func) : Hazaar\\Widgets\\DataAdapter

A callback function called when the request has failed.

Provides: function($jqXHR, $status, $error)

Tags

Since

1.1

Parameters

$funcmixed

JavaScript function code as either a string or a JavaScript object.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
loadServerData()
loadServerData($func) : Hazaar\\Widgets\\DataAdapter

A callback function which allows you to manually handle the ajax calls through the jqxDataAdapter. The function gets passed three arguments: The data to be sent to the server, the source object which initializes the jqxDataAdapter plug-in and a callback function to be called when the ajax call is handled.

Tags

Since

1.1

Parameters

$funcmixed

JavaScript function code as either a string or a JavaScript object.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
processData()
processData($func) : Hazaar\\Widgets\\DataAdapter

A callback function which allows you to modify the default data object sent to the server.

Tags

Since

1.1

Parameters

$funcmixed

JavaScript function code as either a string or a JavaScript object.

Returns

\Hazaar\View\Widgets\Hazaar\\Widgets\\DataAdapter
records()
records() : string

Gets the array of the loaded data records when the data binding is completed.

Tags

Since

1.1

Returns

string
renderObject()
renderObject() : string

Render the dataAdapter as a new JavaScript object.

Tags

Since

1.1

Returns

string