Create the best Web experiences in browsers and devices with our user interface controls designed expressly for jQuery, ASP.NET MVC, HTML 5 and CSS 3. You’ll be building on a solid and proven foundation without any plug-ins or extensions, just real world best practices and the most forward-thinking, robust Web technology.
Infragistics NetAdvantage jQuery API Reference
ig.MashupDataSource
Dependencies
-
mashupSettings
- Type:
- object
- Default:
- {}
-
ignorePartialRecords
- Type:
- bool
- Default:
- false
-
dataSource
- Type:
- array
- Default:
- []
- Elements Type:
Code Sample
var sources = [ {dataSource: namedData, primaryKey: "ProductID"}, {dataSource: "/Samples/demos.dev/server/proxy.php?url=http://services.odata.org/OData/OData.svc/Products?$format=json", schema: {fields: [{name : "Price"}, {name : "Name"}, {name: "ID"}], searchField: "d"}, primaryKey: "ID"} ]; var ds = new $.ig.MashupDataSource({dataSource: sources}); ds.dataBind();
-
settings
- Type:
- unknown
- Default:
- {}
The Infragistics Data Source client-side component is implemented as a class, and has support for paging, sorting, and filtering
it supports binding to various types of data sources including JSON, XML, HTML Table, WCF/REST services, JSONP, JSONP and OData combined, etc.-
id
- Type:
- string
- Default:
- ds
Setting this is only necessary when the data source is set to a table in string format. we need to create an invisible dummy data container in the body and append the table data to it.
-
outputResultsName
- Type:
- string
- Default:
- null
This is the property in the dataView where actual resulting records will be put. (So the dataView will not be array but an object if this is defined), after the potential data source transformation.
-
callback
- Type:
- string
- Default:
- null
Callback function to call when data binding is complete.
-
callee
- Type:
- object
- Default:
- null
Object on which to invoke the callback function.
-
data
- Type:
- object
- Default:
- []
This is the normalized (transformed) resulting data, after it's fetched from the data source.
-
dataSource
- Type:
- object
- Default:
- null
This is the source of data - non normalized. Can be an array, can be reference to some JSON object, can be a DOM element for a HTML TABLE, or a function.
-
dataBinding
- Type:
- object
- Default:
- null
Client-side dataBinding event. Can be a string pointing to a function name, or an object pointing to a function.
-
dataBound
- Type:
- object
- Default:
- null
Client-side dataBound event. Can be a string pointing to a function name, or an object pointing to a function.
-
type
- Type:
- enumeration
- Default:
- unknown
Type of the data source.
Members
- json
- Type:string
- Type of the data source.
- xml
- Type:string
- Type of the data source.
- unknown
- Type:string
- Type of the data source.
- array
- Type:string
- Type of the data source.
- function
- Type:string
- Type of the data source.
- htmlTableString
- Type:string
- Type of the data source.
- htmlTableId
- Type:string
- Type of the data source.
- htmlTableDom
- Type:string
- Type of the data source.
- invalid
- Type:string
- Type of the data source.
- remoteUrl
- Type:string
- Type of the data source.
- empty
- Type:string
- Type of the data source.
-
schema
- Type:
- object
- Default:
- null
A schema object that defines which fields from the data to bind to.
-
primaryKey
- Type:
- string
- Default:
- null
Primary key.
-
responseTotalRecCountKey
- Type:
- string
- Default:
- null
Property in the response which specifies the total number of records in the backend (this is needed for paging).
-
responseDataKey
- Type:
- string
- Default:
- null
Property in the response which specifies where the data records array will be held (if the response is wrapped).
-
responseDataType
- Type:
- enumeration
- Default:
- null
Response type when a URL is set as the data source (can be json, xml, text, etc.). See http://api.jquery.com/jQuery.ajax/ => dataType.
Members
- json
- Type:unknown
- Response type when a URL is set as the data source (can be json, xml, text, etc.). See http://api.jquery.com/jQuery.ajax/ => dataType.
- xml
- Type:unknown
- Response type when a URL is set as the data source (can be json, xml, text, etc.). See http://api.jquery.com/jQuery.ajax/ => dataType.
- html
- Type:unknown
- Response type when a URL is set as the data source (can be json, xml, text, etc.). See http://api.jquery.com/jQuery.ajax/ => dataType.
- script
- Type:unknown
- Response type when a URL is set as the data source (can be json, xml, text, etc.). See http://api.jquery.com/jQuery.ajax/ => dataType.
- jsonp
- Type:unknown
- Response type when a URL is set as the data source (can be json, xml, text, etc.). See http://api.jquery.com/jQuery.ajax/ => dataType.
- text
- Type:unknown
- Response type when a URL is set as the data source (can be json, xml, text, etc.). See http://api.jquery.com/jQuery.ajax/ => dataType.
-
responseContentType
- Type:
- string
- Default:
- null
Content type of the response. See http://api.jquery.com/jQuery.ajax/ => contentType.
-
localSchemaTransform
- Type:
- bool
- Default:
- true
If set to false will disable transformations on schema, even if it is defined locally in the javascript code.
-
urlParamsEncoding
- Type:
- object
- Default:
- null
Event that is fired before URL parameters are encoded. Can point to a function name or the function object itself.
-
urlParamsEncoded
- Type:
- object
- Default:
- null
Event that is fired after URL parameters are encoded (When a remote request is done). Can point to a function name or the function object itself.
-
paging
- Type:
- unknown
- Default:
- {}
Settings related to built-in paging functionality.
-
enabled
- Type:
- bool
- Default:
- false
Paging is not enabled by default.
-
type
- Type:
- enumeration
- Default:
- remote
Type for the paging operation - if local, data is paged locally, if remote - a remote request is done and URL params encoded.
Members
- remote
- Type:unknown
- Type for the paging operation - if local, data is paged locally, if remote - a remote request is done and URL params encoded.
- local
- Type:unknown
- Type for the paging operation - if local, data is paged locally, if remote - a remote request is done and URL params encoded.
-
pageSize
- Type:
- number
- Default:
- 5
Number of records on each page.
-
pageSizeUrlKey
- Type:
- string
- Default:
- null
Denotes the name of the encoded URL parameter that will state what is the currently requested page size.
-
pageIndexUrlKey
- Type:
- string
- Default:
- null
Denotes the name of the encoded URL parameter that will state what is the currently requested page index.
-
pageIndex
- Type:
- number
- Default:
- 0
Current page index.
-
filtering
- Type:
- unknown
- Default:
- {}
Settings related to built-in filtering functionality.
-
type
- Type:
- enumeration
- Default:
- remote
Filtering type. if set to local the data will be filtered automatically locally. If remote, parameters will be encoded and it's up to the backend to interpred them from the response.\r\n.
Members
- remote
- Type:unknown
- Filtering type. if set to local the data will be filtered automatically locally. If remote, parameters will be encoded and it's up to the backend to interpred them from the response.\r\n.
- local
- Type:unknown
- Filtering type. if set to local the data will be filtered automatically locally. If remote, parameters will be encoded and it's up to the backend to interpred them from the response.\r\n.
-
caseSensitive
- Type:
- bool
- Default:
- false
Enables or disables case sensitive filtering on the data. Works only for local filtering.
-
applyToAllData
- Type:
- bool
- Default:
- true
If the type of paging/sorting/filtering is local and applyToAllData is true, filtering will be performed on the whole data source that's present locally, otherwise only on the current dataView. if type is remote, this setting doesn't have any effect.
-
customFunc
- Type:
- object
- Default:
- null
Can point to either a string or a function object. The parameters that are passed are 1) the data array to be filtered, 2) the filtering expression definitions. should return an array of the filtered data.
-
filterExprUrlKey
- Type:
- string
- Default:
- null
Url key that will be encoded in the request if remote filtering is performed. Default value of null implies OData-style URL encoding. Please see http://www.odata.org/developers/protocols/uri-conventions for details.
-
filterLogicUrlKey
- Type:
- string
- Default:
- filterlogic
Url key that will be encoded in the request, specifying if the filtering logic will be AND or OR.
-
expressions
- Type:
- object
- Default:
- []
A list of expression objects, containing the following key-value pairs: fieldName, expression (search string), condition , and logic (AND/OR).
-
exprString
- Type:
- string
- Default:
- ""
An "SQL-like' encoded expressions string. takes precedence over "expressions". Example: col2 > 100; col2 LIKE %test%.
-
sorting
- Type:
- unknown
- Default:
- {}
Settings related to built-in sorting functionality.
-
defaultDirection
- Type:
- enumeration
- Default:
- none
Sorting direction.
Members
- none
- Type:unknown
- Sorting direction.
- asc
- Type:unknown
- Sorting direction.
- desc
- Type:unknown
- Sorting direction.
-
defaultFields
- Type:
- object
- Default:
- []
When defaultDirection is different than "none", and defaultFields is specified, data will be initially sorted accordingly, directly after dataBind().
-
applyToAllData
- Type:
- bool
- Default:
- true
If the sorting type is local and applyToAllData is true, sorting will be performed on the whole data source that's present locally, otherwise only on the current dataView. if sorting type is remote, this setting doesn't have any effect.
-
customFunc
- Type:
- object
- Default:
- null
Custom sorting function that can point to either a string or a function object. When the function is called, the following arguments are passed: data array, fields (array of field definitions) , direction ("asc" or "desc"). The function should return a sorted data array.
-
compareFunc
- Type:
- object
- Default:
- null
Custom comparison sorting function. Accepts two values and returns a value 0 indicating that values are equal, 1 indicating that val1 > val2 and -1 indicating that val1 < val2.
-
customConvertFunc
- Type:
- object
- Default:
- null
Custom data value conversion function. Accepts a value and should return the converted value.
-
type
- Type:
- enumeration
- Default:
- remote
Specifies whether sorting will be applied locally or remotely (via a remote request).
Members
- remote
- Type:unknown
- Specifies whether sorting will be applied locally or remotely (via a remote request).
- local
- Type:unknown
- Specifies whether sorting will be applied locally or remotely (via a remote request).
-
caseSensitive
- Type:
- bool
- Default:
- false
Specifies if sorting will be case sentsitive or not.
-
sortUrlKey
- Type:
- string
- Default:
- null
URL param name which specifies how sorting expressions will be encoded in the URL. Default is null and uses OData conventions.
-
sortUrlAscValueKey
- Type:
- string
- Default:
- null
URL param value for ascending type of sorting. Default is null and uses OData conventions.
-
sortUrlDescValueKey
- Type:
- string
- Default:
- null
URL param value for descending type of sorting. Default is null and uses OData conventions.
-
expressions
- Type:
- object
- Default:
- []
A list of sorting expressions , consisting of the following keys (and their respective values): fieldName and direction.
-
exprString
- Type:
- string
- Default:
- ""
Takes precedence over experssions, an "SQL-like" encoded expressions string : see sort(). Example col2 > 100 ORDER BY asc.
-
fields
- Type:
- object
- Default:
- []
A list of field definitions specifying the schema of the data source.
-
serializeTransactionLog
- Type:
- bool
- Default:
- true
If true, will serialize the transaction log of updated values - if any - whenever commit is performed via a remote request.
-
autoCommit
- Type:
- bool
- Default:
- false
If auto commit is true, data will be automatically commited to the data source, once a value or a batch of values are updated via saveChanges().
-
updateUrl
- Type:
- string
- Default:
- null
Specifies an update remote URL, to which an AJAX request will be made as soon as saveChages() is called.
-
ig.MashupDataSource
- .MashupDataSource( "ig.MashupDataSource", options:unknown );
- options
- Type:unknown
-
addRow
- .MashupDataSource( "addRow", rowId:object, rowObject:object, autoCommit:bool );
- Return Type:
- object
Adds a new row to the data source. Creates a transaction that can be committed / rolled back.
- rowId
- Type:object
- the record key - primaryKey (string) or index (number).
- rowObject
- Type:object
- the new record data.
- autoCommit
- Type:bool
- if autoCommit is true, the datasource will be updated automatically and the transaction is still stored in the accumulated transaction log.
-
allTransactions
- .MashupDataSource( "allTransactions" );
- Return Type:
- array
Returns a list of all transaction objects that are either pending, or have been committed in the data source.
-
analyzeDataSource
- .MashupDataSource( "analyzeDataSource" );
- Return Type:
- string
Analyzes the dataSource setting to automatically determine the type of the data source. Returns the data source type. See settings.type.
-
commit
- .MashupDataSource( "commit", [id:number] );
Update the data source with every transaction from the log.
- id
- Type:number
- Optional
- Id of the transaction to commit. If no id is specified, will commit all transactions to the data source.
-
data
- .MashupDataSource( "data" );
- Return Type:
- object
Returns all of the bound data, without taking into account local paging, sorting, filtering, etc.
-
dataBind
- .MashupDataSource( "dataBind" );
-
dataSource
- .MashupDataSource( "dataSource", [ds:object] );
- Return Type:
- object
Gets/sets the dataSource setting. if no parameter is specified, returns settings.dataSource.
- ds
- Type:object
- Optional
- .
-
dataView
- .MashupDataSource( "dataView" );
- Return Type:
- object
Returns the current normalized/transformed and paged/filtered/sorted data, i.e. the dataView.
-
deleteRow
- .MashupDataSource( "deleteRow", rowId:object, autoCommit:bool );
- Return Type:
- object
Deletes a row from the data source.
- rowId
- Type:object
- the record key - primaryKey (string) or index (number).
- autoCommit
- Type:bool
- if autoCommit is true, the datasource will be updated automatically and the transaction is still stored in the accumulated transaction log.
-
fields
- .MashupDataSource( "fields", [fields:object] );
- Return Type:
- object
Sets a list of fields to the data source. If no parameter is specified, just returns the already existing list of fields.
- fields
- Type:object
- Optional
- a field has the following format: {key: 'fieldKey', dataType: 'string/number/date' }.
-
filter
- .MashupDataSource( "filter", fieldExpressions:object, boolLogic:unknown, keepFilterState:bool );
Filters the data source locally. Remote filtering can be performed by just calling dataBind() and setting the settings.filtering.expressions. The result (filtered data) can be obtained by calling dataView()
example: [{fieldName : "firstName", expr: "abc", cond: "StartsWith"}, {fieldName : "lastName"}]
example 2: [{fieldIndex : 1} , {fieldIndex : 2, expr: "a", cond : "contains"}]
expr is the filter expression text , such as "abc", or a regular expression such as *test*
cond is the filtering condition such as startsWith, endsWith, contains, equals, doesNotEqual, doesNotContain
if expr is detected to be a regular expression, the "cond" part is skipped
.- fieldExpressions
- Type:object
- a list of field expression definitions.
- boolLogic
- Type:unknown
- boolean logic. Accepted values are AND and OR.
- keepFilterState
- Type:bool
- if keepFilterState is set to true, it will not discard previous filtering expressions.
-
filterSettings
- .MashupDataSource( "filterSettings", [f:object] );
Gets/sets a list of filtering settings.
- f
- Type:object
- Optional
- object holding all filtering settings. See settings.filtering.
-
findRecordByKey
- .MashupDataSource( "findRecordByKey", key:string );
- Return Type:
- object
Returns a record by a specified key (requires that primaryKey is set in the settings).
- key
- Type:string
- Primary key of the record.
-
getDetachedRecord
- .MashupDataSource( "getDetachedRecord", t:object );
- Return Type:
- object
Returns a standalone object (copy) that represents the commited transactions, but detached from the data source.
- t
- Type:object
- a transaction object.
-
hasTotalRecordsCount
- .MashupDataSource( "hasTotalRecordsCount", hasCount:bool );
Gets / sets if the response from the server contains a property which specifies the total number of records in the server-side backend.
- hasCount
- Type:bool
- specifies if the data source contains a property that denotes the total number of records in the server-side backend.
-
nextPage
- .MashupDataSource( "nextPage" );
Sets the page index to be equal to the next page index and rebinds the data source.
-
pageCount
- .MashupDataSource( "pageCount" );
- Return Type:
- number
Returns the total number of pages.
-
pageIndex
- .MashupDataSource( "pageIndex", [index:number] );
- Return Type:
- number
Gets /sets the current page index. if an index is passed as a parameter, the data source is re-bound.
- index
- Type:number
- Optional
- the page index. if none is specified, returns the current page index.
-
pageSize
- .MashupDataSource( "pageSize", [s:number] );
Gets /sets the page size and rebinds the data source if a parameter is specified. if no parameter is passed, returns the current page size.
- s
- Type:number
- Optional
- the page size.
-
pageSizeDirty
- .MashupDataSource( "pageSizeDirty", dirty:unknown );
- dirty
- Type:unknown
-
pagingSettings
- .MashupDataSource( "pagingSettings", [p:object] );
Gets/sets a list of paging settings.
- p
- Type:object
- Optional
- object holding all paging settings. See settings.paging.
-
pendingTransactions
- .MashupDataSource( "pendingTransactions" );
- Return Type:
- array
Returns a list of all transaction objects that are pending to be committed or rolled back to the data source.
-
prevPage
- .MashupDataSource( "prevPage" );
Sets the page index to be equal to the previous page index and rebinds the data source.
-
recordsForPage
- .MashupDataSource( "recordsForPage", p:number );
Returns a list of records for the specified page. implies that paging is enabled.
- p
- Type:number
- the page index for which records will be returned.
-
removeRecordByKey
- .MashupDataSource( "removeRecordByKey", key:string );
Removes a specific record denoted by the primaryKey of the passed key parameter from the data source.
- key
- Type:string
- primary key of the record.
-
rollback
- .MashupDataSource( "rollback", [id:number] );
Clears the transaction log without updating anything in the data source.
- id
- Type:number
- Optional
- Id of the transaction to rollback. If no id is specified, will rollback all transactions to the data source.
-
saveChanges
- .MashupDataSource( "saveChanges" );
Posts to the settings.updateUrl using $.ajax, by serializing the changes as url params.
-
schema
- .MashupDataSource( "schema", [s:object], [t:string] );
Gets/sets the schema definition.
- s
- Type:object
- Optional
- a schema object.
- t
- Type:string
- Optional
- type of the data source. See settings.type.
-
setCellValue
- .MashupDataSource( "setCellValue", rowId:object, colId:object, val:object, autoCommit:bool );
- Return Type:
- object
Sets a cell value for the cell denoted by rowId and colId. Creates a transaction for the update operation and returns it.
- rowId
- Type:object
- the rowId - row key (string) or index (number).
- colId
- Type:object
- the column id - column key (string) or index (number).
- val
- Type:object
- The new value.
- autoCommit
- Type:bool
- if autoCommit is true, it updates the datasource automatically and the transaction is still stored in the accumulated transaction log.
-
sort
- .MashupDataSource( "sort", fields:object, direction:string, keepSortState:bool );
Sorts the data source locally. The result (filtered data) can be obtained by calling dataView(). Remote filtering can be performed by just calling dataBind() and setting the settings.filtering.expressions
multi-column sorting can be enabled by setting keepSortState to true.
fields => an array of fields object definitions:
example: [{fieldName : "firstName"}, {fieldName : "lastName"}]
example 2: [{fieldIndex : 1} , {fieldIndex : 2}]
.- fields
- Type:object
- an array of fields object definitions.
- direction
- Type:string
- asc / desc direction.
- keepSortState
- Type:bool
- if set to true, enables multi-column sorting, and the previous sorting state is not cleared.
-
sortSettings
- .MashupDataSource( "sortSettings", [s:object] );
Gets/sets a list of paging settings.
- s
- Type:object
- Optional
- object holding all sorting settings. See settings.sorting.
-
stringToJSONObject
- .MashupDataSource( "stringToJSONObject", s:string );
Parses the string and returns an evaluated JSON object.
- s
- Type:string
- the JSON as string.
-
stringToXmlObject
- .MashupDataSource( "stringToXmlObject", s:string );
Parses a string and returns a XML Document.
- s
- Type:string
- the XML represented as a string.
-
tableToObject
- .MashupDataSource( "tableToObject", tableDOM:domelement );
- Return Type:
- object
Converts a HTML TABLE dom element to a JavaScript array of objects that contain the records data.
- tableDOM
- Type:domelement
- TABLE dom element to transform.
-
totalLocalRecordsCount
- .MashupDataSource( "totalLocalRecordsCount" );
- Return Type:
- number
Returns the total number of records in the local data source.
-
totalRecordsCount
- .MashupDataSource( "totalRecordsCount", [count:number] );
Applicable only when the data source is bound to remote data. gets / sets the total number of records in the data source. If data binding is remote, and there's paging or filteing enabled, the actual total number of records may not
match the number of records that exists on the client.- count
- Type:number
- Optional
- the total number of records.
-
transactionsAsString
- .MashupDataSource( "transactionsAsString" );
- Return Type:
- string
Returns the accumulated transaction log as a string. The purpose of this is to be passed to URLs or used conveniently.
-
type
- .MashupDataSource( "type", [t:unknown] );
Gets/sets the type of the dataSource. if no parameter is specified, returns settings.type
returnType="json|xml|unknown|array|function|htmlTableString|htmlTableId|htmlTableDom|invalid|remoteUrl|empty.- t
- Type:unknown
- Optional
- .
-
updateRow
- .MashupDataSource( "updateRow", rowId:object, rowObject:object, autoCommit:bool );
- Return Type:
- object
Updates a record in the datasource. Creates a transaction that can be committed / rolled back.
- rowId
- Type:object
- the record key - primaryKey (string) or index (number).
- rowObject
- Type:object
- the record object containing the key/value pairs we want to update. It doesn't have to include key/value pairs for all fields defined in the schema or in the data source (if no schema is defined).
- autoCommit
- Type:bool
- if autoCommit is true, the datasource will be updated automatically and the transaction is still stored in the accumulated transaction log.
