Ignite UI API Reference

ig.MashupDataSource

ig.MashupDataSource_image

The MashupDataSource is used to create a single collection of data from multiple sources. The sources are combined using a common primary key field. This class is an extension of the DataSource class which adds the options for mashupSettings. For more details on the MashupDataSource component’s API, refer to the base DataSource component’s API documentation. Further information regarding the classes, options, events, methods and themes of this API are available under the associated tabs above.

The following code snippet demonstrates how to initialize the MashupDataSource control.

Click here for more information on how to get started using this API. For details on how to reference the required scripts and themes for the MashupDataSource control read, Using JavaScript Resources in Ignite UI and Styling and Theming Ignite UI.

Code Sample

<!doctype html>
<html>
<head>
    <!-- Infragistics Combined CSS -->
    <link href="css/themes/infragistics/infragistics.theme.css" rel="stylesheet" type="text/css" />
    <link href="css/structure/infragistics.css" rel="stylesheet" type="text/css" />
    <!-- jQuery Core -->
    <script src="js/jquery.js" type="text/javascript"></script>
    <!-- jQuery UI -->
    <script src="js/jquery-ui.js" type="text/javascript"></script>
    <!-- Infragistics Combined Scripts -->
    <script src="js/infragistics.core.js" type="text/javascript"></script>

    <script type="text/javascript">
    $(function () {
        var jsArray = new Array(), xmlDoc, xmlSchema, mashupSources, dsMashup;

	    jsArray[0] = { "ID": 0, "Name": "Bread", "Description": "Whole grain bread" };
	    jsArray[1] = { "ID": 1, "Name": "Milk", "Description": "Low fat milk" };
	    jsArray[2] = { "ID": 2, "Name": "Vint soda", "Description": "Americana Variety - Mix of 6 flavors" };
	    jsArray[3] = { "ID": 3, "Name": "Havina Cola", "Description": "The Original Key Lime Cola"};
	    jsArray[4] = { "ID": 4, "Name": "Fruit Punch", "Description": "Mango flavor, 8.3 Ounce Cans (Pack of 24)"};
	    jsArray[5] = { "ID": 5, "Name": "Cranberry Juice", "Description": "16-Ounce Plastic Bottles (Pack of 12)"};
	    jsArray[6] = { "ID": 6, "Name": "Pink Lemonade", "Description": "36 Ounce Cans (Pack of 3)" };
	    jsArray[7] = { "ID": 7, "Name": "DVD Player", "Description": "1080P Upconversion DVD Player" };
	    jsArray[8] = { "ID": 8, "Name": "LCD HDTV", "Description": "42 inch 1080p LCD with Built-in Blu-ray Disc Player" };

	    xmlDoc = "<feed>\r\n" +
                    "<entry>\r\n" +
                        "<id>0</id>\r\n    <title>Bread</title>\r\n    <summary>Whole grain bread</summary>\r\n    <content id=\"0\" rating=\"4\" price=\"2.5\"></content>\r\n </entry>\r\n" +
                    "<entry>\r\n" +
                        "<id>1</id>\r\n    <title>Milk</title>\r\n    <summary>Low fat milk</summary>\r\n    <content id=\"1\" rating=\"3\" price=\"3.5\"></content>\r\n  </entry>\r\n" +
                    "<entry>\r\n" +
                        "<id>2</id>\r\n    <title>Vint soda</title>\r\n    <summary>Americana Variety - Mix of 6 flavors</summary>\r\n    <content id=\"2\" rating=\"3\" price=\"20.9\"></content>\r\n  </entry>\r\n" +
                    "<entry>\r\n" +
                        "<id>3</id>\r\n    <title>Havina Cola</title>\r\n    <summary>The Original Key Lime Cola</summary>\r\n    <content id=\"3\" rating=\"3\" price=\"19.9\"></content>\r\n  </entry>\r\n" +
                    "<entry>\r\n" + 
                        "<id>4</id>\r\n    <title>Fruit Punch</title>\r\n    <summary>Mango flavor, 8.3 Ounce Cans (Pack of 24)</summary>\r\n    <content id=\"4\" rating=\"3\" price=\"22.99\"></content>\r\n  </entry>\r\n" +
                    "<entry>\r\n" +
                        "<id>5</id>\r\n    <title>Cranberry Juice</title>\r\n    <summary>16-Ounce Plastic Bottles (Pack of 12)</summary>\r\n    <content id=\"5\" rating=\"3\" price=\"22.8\"></content>\r\n  </entry>\r\n" +
                    "<entry>\r\n" + 
                        "<id>6</id>\r\n    <title>Pink Lemonade</title>\r\n    <summary>36 Ounce Cans (Pack of 3)</summary>\r\n    <content id=\"6\" rating=\"3\" price=\"18.8\"></content>\r\n  </entry>\r\n" +
                    "<entry>\r\n" +
                        "<id>7</id>\r\n    <title>DVD Player</title>\r\n    <summary>1080P Upconversion DVD Player</summary>\r\n    <content id=\"7\" rating=\"3\" price=\"35.88\"></content>\r\n  </entry>\r\n" +
                    "<entry>\r\n" +
                        "<id>8</id>\r\n    <title>LCD HDTV</title>\r\n    <summary>42 inch 1080p LCD with Built-in Blu-ray Disc Player</summary>\r\n    <content id=\"8\" rating=\"3\" price=\"1088.8\"></content>\r\n  </entry>\r\n" + 
                "</feed>";			
	    
        xmlSchema = new $.ig.DataSchema("xml", { 
		    fields: [ 
			    { name : "ID", xpath: "id" },
			    { name : "Rating", xpath: "content/@rating" },
			    { name : "Price", xpath : "content/@price" }
		    ],
		    searchField: "//entry"
	    });
			
	    mashupSources = [
		    { dataSource: jsArray, primaryKey: "ID" },
		    { dataSource: xmlDoc, type: "xml", primaryKey: "ID" ,schema: xmlSchema }
	    ];
			
	    dsMashup = new $.ig.MashupDataSource({ dataSource: mashupSources });
	    dsMashup.dataBind();
  
      var template = "<tr><td>${ID}</td><td>${Name}</td><td>${Description}</td><td>${Rating}</td><td>${Price}</td></tr>",
      resultHtml = $.ig.tmpl(template, dsMashup.dataView());
      $("#mashupDataSource").html(resultHtml);
    });
    </script>
</head>
<body>
	<table id="mashupDataSource">
        <thead></thead>
        <tbody></tbody>
    </table>
</body>
</html>
    

Related Samples

Related Topics

Dependencies

jquery-1.4.4.js
infragistics.util.js
  • mashupSettings

    Type:
    object
    Default:
    {}

    Defines the configuration setting for the mashup data source.

    Code Sample

     			
                var jsArray = new Array(), xmlDoc, xmlSchema, mashupSources, dsMashup;
    
    			jsArray[0] = { "ID": 0, "Name": "Bread", "Description": "Whole grain bread" };
    			jsArray[1] = { "ID": 1, "Name": "Milk", "Description": "Low fat milk" };
    			jsArray[2] = { "ID": 2, "Name": "Vint soda", "Description": "Americana Variety - Mix of 6 flavors" };
    			jsArray[3] = { "ID": 3, "Name": "Havina Cola", "Description": "The Original Key Lime Cola"};
    			jsArray[4] = { "ID": 4, "Name": "Fruit Punch", "Description": "Mango flavor, 8.3 Ounce Cans (Pack of 24)"};
    			jsArray[5] = { "ID": 5, "Name": "Cranberry Juice", "Description": "16-Ounce Plastic Bottles (Pack of 12)"};
    			jsArray[6] = { "ID": 6, "Name": "Pink Lemonade", "Description": "36 Ounce Cans (Pack of 3)" };
    			jsArray[7] = { "ID": 7, "Name": "DVD Player", "Description": "1080P Upconversion DVD Player" };
    			jsArray[8] = { "ID": 8, "Name": "LCD HDTV", "Description": "42 inch 1080p LCD with Built-in Blu-ray Disc Player" };
    			
    			xmlDoc = loadXMLDoc("XML.Products.xml");			
    			xmlSchema = new $.ig.DataSchema("xml", { 
    				fields: [ 
    					{ name : "ID", xpath: "id" },
    					{ name : "Rating", xpath: "content/@rating" },
    					{ name : "Price", xpath : "content/@price" }
    				],
    				searchField: "//entry"
    			});
    			
    			mashupSources = [
    				{ dataSource: jsArray, primaryKey: "ID" },
    				{ dataSource: xmlDoc, type: "xml", primaryKey: "ID" ,schema: xmlSchema }
    			];
    			
    			dsMashup = new $.ig.MashupDataSource({ dataSource: mashupSources });
    			dsMashup.dataBind(); 
                
    • dataSource

      Type:
      array
      Default:
      []
      Elements Type:
      object

      An array of $.ig.DataSource instances holding the disperse data.

      Code Sample

       
                	//Initializenew 
                  $.ig.MashupDataSource({ dataSource: [
      				{ dataSource: jsArray, primaryKey: "ID" },
      				{ dataSource: xmlDoc, type: "xml", primaryKey: "ID" ,schema: xmlSchema }
      			    ] 
                  });
                  
    • ignorePartialRecords

      Type:
      bool
      Default:
      false

      Indicates whether to ignore records that have no corresponding data in all of the provided data sources.

      Code Sample

       
                  //Initializenew 
                  $.ig.MashupDataSource({ 
                      ignorePartialRecords: true
                  });
                
  • &nbspsettings

    Type:
    object
    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.

    • aggregateTransactions

      Type:
      bool
      Default:
      false

      If set to true, the following behavior will take place:
      if a new row is added, and then deleted, there will be no transaction added to the log
      if an edit is made to a row or cell, then the value is brought back to its original value, the transaction should be removed
      Note: This option takes effect only when autoCommit is set to false.

    • 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().

      Code Sample

                   
                    //Initializenew 
                      $.ig.MashupDataSource({ 
                          autoCommit: true
                      }); 
                   
    • callback

      Type:
      function
      Default:
      null

      Callback function to call when data binding is complete.

      Code Sample

       
                      //Initializenew 
                      $.ig.MashupDataSource({ 
                          callback: function() {  }
                      }); 
                
    • callee

      Type:
      object
      Default:
      null

      Object on which to invoke the callback function.

      Code Sample

       
                      //Initializenew 
                      $.ig.MashupDataSource({ 
                          callee: function() {  }
                      }); 
                
    • data

      Type:
      array
      Default:
      []
      Elements Type:
      object

      This is the normalized (transformed) resulting data, after it's fetched from the data source.

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

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

    • fields

      Type:
      array
      Default:
      []
      Elements Type:
      object

      A list of field definitions specifying the schema of the data source.
      Field objects description: {fieldName, [fieldDataType], [fieldXPath]}.

    • filtering

      Type:
      object
      Default:
      {}

      Settings related to built-in filtering functionality.

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

      • caseSensitive

        Type:
        bool
        Default:
        false

        Enables or disables case sensitive filtering on the data. Works only for local filtering.

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

      • defaultFields

        Type:
        array
        Default:
        []
        Elements Type:
        object

        Data will be initially filtered accordingly, directly after dataBind().

      • expressions

        Type:
        array
        Default:
        []
        Elements Type:
        object

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

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

      • type

        Type:
        enumeration
        Default:
        remote

        Filtering type.

        Members

        • remote
        • Type:string
        • Parameters will be encoded and it's up to the backend to interpred them from the response.
        • local
        • Type:string
        • The data will be filtered automatically client-side.
    • 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.

    • localSchemaTransform

      Type:
      bool
      Default:
      true

      If set to false will disable transformations on schema, even if it is defined locally in the javascript code.

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

    • paging

      Type:
      object
      Default:
      {}

      Settings related to built-in paging functionality.

      • appendPage

        Type:
        bool
        Default:
        false

        Whether when a new page of data is requested we should append the new data to the existing data.

      • enabled

        Type:
        bool
        Default:
        false

        Paging is not enabled by default.

      • pageIndex

        Type:
        number
        Default:
        0

        Current page index.

      • pageIndexUrlKey

        Type:
        string
        Default:
        null

        Denotes the name of the encoded URL parameter that will state what is the currently requested page index.

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

      • type

        Type:
        enumeration
        Default:
        remote

        Type for the paging operation .

        Members

        • local
        • Type:string
        • Data is paged client-side.
        • remote
        • Type:string
        • A remote request is done and URL params encoded.
    • primaryKey

      Type:
      string
      Default:
      null

      The unique field identifier.

    • requestType

      Type:
      string
      Default:
      get

      Specifies the HTTP verb to be used to issue the request.

    • responseContentType

      Type:
      string
      Default:
      null

      Content type of the response. See http://api.jquery.com/jQuery.ajax/ => contentType.

    • 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. See http://api.jquery.com/jQuery.ajax/ => dataType .

      Members

      • json
      • Type:string
      • xml
      • Type:string
      • html
      • Type:string
      • script
      • Type:string
      • jsonp
      • Type:string
      • text
      • Type:string
    • responseTotalRecCountKey

      Type:
      string
      Default:
      null

      Property in the response which specifies the total number of records in the backend (this is needed for paging).

    • rowAdded

      Type:
      function
      Default:
      null

      A function to call when row is added.
      Function takes first argument item and second argument dataSource.
      Use item.row to obtain reference to the added row.
      Use item.rowId to get the row ID.
      Use dataSource to obtain reference to $.ig.DataSource.

    • rowDeleted

      Type:
      function
      Default:
      null

      A function to call when row is deleted.
      Use item.row to obtain reference to the deleted row.
      Use item.rowId to get the row ID.
      Use item.rowIndex to get the row index.
      Use dataSource to obtain reference to $.ig.DataSource.

    • rowInserted

      Type:
      function
      Default:
      null

      A function to call when row is inserted.
      Function takes first argument item and second argument dataSource.
      Use item.row to obtain reference to the inserted row.
      Use item.rowId to get the row ID.
      Use item.rowIndex to get the row index.
      Use dataSource to obtain reference to $.ig.DataSource.

    • rowUpdated

      Type:
      function
      Default:
      null

      A function to call when row is updated (edited).
      Function takes first argument item and second argument dataSource.
      Use item.rowIndex to get the row index.
      Use item.newRow to obtain reference to the updated row.
      Use item.oldRow to obtain reference to the row that was updated.
      Use dataSource to obtain reference to $.ig.DataSource.

    • schema

      Type:
      object
      Default:
      null

      A schema object that defines which fields from the data to bind to.

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

    • sorting

      Type:
      object
      Default:
      {}

      Settings related to built-in sorting functionality.

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

      • caseSensitive

        Type:
        bool
        Default:
        false

        Specifies if sorting will be case sensitive or not. Works only for local sorting.

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

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

      • defaultDirection

        Type:
        enumeration
        Default:
        none

        Sorting direction .

        Members

        • none
        • Type:string
        • asc
        • Type:string
        • desc
        • Type:string
      • defaultFields

        Type:
        array
        Default:
        []
        Elements Type:
        object

        When defaultDirection is different than "none", and defaultFields is specified, data will be initially sorted accordingly, directly after dataBind().

      • expressions

        Type:
        array
        Default:
        []
        Elements Type:
        object

        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.

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

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

      • type

        Type:
        enumeration
        Default:
        remote

        Specifies whether sorting will be applied locally or remotely (via a remote request) .

        Members

        • remote
        • Type:string
        • local
        • Type:string
    • summaries

      Type:
      object
      Default:
      {}

      Settings related to built-in summaries functionality.

      • columnSettings

        Type:
        array
        Default:
        []
        Elements Type:
        object

        A list of column settings that specifies custom summaries options per column basis.

      • summariesResponseKey

        Type:
        string
        Default:
        summaries

        Key for retrieving data from the summaries response - used only when summaries are remote.

      • summaryExecution

        Type:
        enumeration
        Default:
        afterfilteringandpaging

        Determines when the summary values are calculated .

        Members

        • priortofilteringandpaging
        • Type:string
        • afterfilteringbeforepaging
        • Type:string
        • afterfilteringandpaging
        • Type:string
      • summaryExprUrlKey

        Type:
        string
        Default:
        summaries

        Url key for retrieving data from response - used only when summaries are remote.

      • type

        Type:
        enumeration
        Default:
        remote

        Specifies whether summaries will be applied locally or remotely (via a remote request) .

        Members

        • remote
        • Type:string
        • A remote request is done and URL params encoded.
        • local
        • Type:string
        • Data is paged client-side.
    • type

      Type:
      enumeration
      Default:
      unknown

      Type of the data source .

      Members

      • json
      • Type:string
      • Specifies that the data source is an already evaluated JSON (JavaScript object/array) or a string that can be evaluated to JSON.
      • xml
      • Type:string
      • Specifies that the data source is a XML Document object or a string that can be evaluated to XML.
      • unknown
      • Type:string
      • Specifies that the data source is of unknown type. In that case it will be analyzed and automatically detected if possible.
      • array
      • Type:string
      • Specifies that the data source is a simple array of objects.
      • htmlTableString
      • Type:string
      • Specifies that the data source points to a string that represents a HTML table.
      • htmlTableId
      • Type:string
      • Specifies that the data source points to an ID of a HTML Table element that's loaded on the page.
      • htmlTableDom
      • Type:string
      • The data source points to a DOM object that is of TABLE type.
      • invalid
      • Type:string
      • Set whenever data source is analyzed (in case its type is unknown) and the type cannot be detected.
      • remoteUrl
      • Type:string
      • Specifies that the data source points to a remote URL, from which data will be retrieved using an AJAX call ($.ajax).
      • empty
      • Type:string
    • updateUrl

      Type:
      string
      Default:
      null

      Specifies an update remote URL, to which an AJAX request will be made as soon as saveChages() is called.

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

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

The current widget has no events.
  • &nbspig.MashupDataSource

    new $.ig.MashupDataSource( options:object );

    • options
    • Type:object
  • &nbspaddNode

    .addNode( data:object );

    Adds a new node to the tree data source. Creates a transaction that can be committed / rolled back.

    • data
    • Type:object
    • the transaction data.
  • &nbspaddRow

    .addRow( rowId:object, rowObject:object, autoCommit:bool );
    Return Type:
    object
    Return Type Description:
    . The transaction object that was created.

    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.
  • &nbspallTransactions

    .allTransactions( );
    Return Type:
    array

    Returns a list of all transaction objects that are either pending, or have been committed in the data source.

  • &nbspanalyzeDataSource

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

  • &nbspclearLocalFilter

    .clearLocalFilter( );

    This clears local filtering applied to the data view by resetting it to the original data and applying any paging.

  • &nbspclearLocalSorting

    .clearLocalSorting( );

    This clears local sorting applied to the data view by resetting it to the original data and applying any paging.

  • &nbspcommit

    .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.
  • &nbspdata

    .data( );
    Return Type:
    object

    Returns all of the bound data, without taking into account local paging, sorting, filtering, etc.

  • dataBind

    .dataBind( );

  • &nbspdataSource

    .dataSource( [ds:object] );
    Return Type:
    object

    Gets/sets the dataSource setting. If no parameter is specified, returns settings.dataSource.

    • ds
    • Type:object
    • Optional
    • .
  • &nbspdataSummaries

    .dataSummaries( );
    Return Type:
    object

    Returns summaries data.

  • &nbspdataView

    .dataView( );
    Return Type:
    object

    Returns the current normalized/transformed and paged/filtered/sorted data, i.e. the dataView.

  • &nbspdeleteRow

    .deleteRow( rowId:object, autoCommit:bool );
    Return Type:
    object
    Return Type Description:
    . The transaction object that was created.

    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.
  • &nbspfields

    .fields( [fields:object] );
    Return Type:
    object
    Return Type Description:
    if no parameters are specified, returns the existing list of fields.

    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' }.
  • &nbspfilter

    .filter( fieldExpressions:object, boolLogic:object, keepFilterState:bool, fieldExpressionsOnStrings:object );

    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:object
    • boolean logic. Accepted values are AND and OR. .
    • keepFilterState
    • Type:bool
    • if keepFilterState is set to true, it will not discard previous filtering expressions.
    • fieldExpressionsOnStrings
    • Type:object
  • &nbspfilterSettings

    .filterSettings( [f:object] );

    Gets/sets a list of filtering settings.

    • f
    • Type:object
    • Optional
    • object holding all filtering settings. See settings.filtering.
  • &nbspfindRecordByKey

    .findRecordByKey( key:string, ds:object );
    Return Type:
    object
    Return Type Description:
    a JavaScript object specifying the found record, or null if no record is found.

    Returns a record by a specified key (requires that primaryKey is set in the settings).

    • key
    • Type:string
    • Primary key of the record.
    • ds
    • Type:object
  • &nbspgetDetachedRecord

    .getDetachedRecord( t:object );
    Return Type:
    object
    Return Type Description:
    a copy of a record from the data source.

    Returns a standalone object (copy) that represents the commited transactions, but detached from the data source.

    • t
    • Type:object
    • a transaction object.
  • &nbsphasTotalRecordsCount

    .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.
  • &nbspinsertRow

    .insertRow( rowId:object, rowObject:object, rowIndex:bool, autoCommit:object );
    Return Type:
    object
    Return Type Description:
    . The transaction object that was created.

    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. .
    • rowIndex
    • Type:bool
    • if autoCommit is true, the datasource will be updated automatically and the transaction is still stored in the accumulated transaction log.
    • autoCommit
    • Type:object
  • &nbspmetadata

    .metadata( key:string );
    Return Type:
    object
    Return Type Description:
    metadata object.

    Returns metadata object for the specified key.

    • key
    • Type:string
    • Primary key of the record.
  • &nbspnextPage

    .nextPage( );

    Sets the page index to be equal to the next page index and rebinds the data source.

  • &nbsppageCount

    .pageCount( );
    Return Type:
    number
    Return Type Description:
    total number fo pages.

    Returns the total number of pages.

  • &nbsppageIndex

    .pageIndex( [index:number] );
    Return Type:
    number
    Return Type Description:
    the current page index.

    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.
  • &nbsppageSize

    .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.
  • &nbsppageSizeDirty

    .pageSizeDirty( );

    For internal use.

  • &nbsppagingSettings

    .pagingSettings( [p:object] );

    Gets/sets a list of paging settings.

    • p
    • Type:object
    • Optional
    • object holding all paging settings. See settings.paging.
  • &nbsppendingTransactions

    .pendingTransactions( );
    Return Type:
    array

    Returns a list of all transaction objects that are pending to be committed or rolled back to the data source.

  • &nbspprevPage

    .prevPage( );

    Sets the page index to be equal to the previous page index and rebinds the data source.

  • &nbsprecordsForPage

    .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.
  • &nbspremoveNode

    .removeNode( data:object );

    Removes a node from the tree data source. Creates a transaction that can be committed / rolled back.

    • data
    • Type:object
    • the transaction data.
  • &nbspremoveRecordByIndex

    .removeRecordByIndex( index:number, origDs:object );

    Removes a record from the data source at specific index.

    • index
    • Type:number
    • index of record.
    • origDs
    • Type:object
  • &nbspremoveRecordByKey

    .removeRecordByKey( key:string, origDs:object );

    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.
    • origDs
    • Type:object
  • &nbsprollback

    .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.
  • &nbspsaveChanges

    .saveChanges( success:function, error:function );

    Posts to the settings.updateUrl using $.ajax, by serializing the changes as url params.

    • success
    • Type:function
    • Specifies a custom function to be called when AJAX request to the updateUrl option succeeds(optional).
    • error
    • Type:function
    • Specifies a custom function to be called when AJAX request to the updateUrl option fails(optional).
  • &nbspschema

    .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.
  • &nbspsetCellValue

    .setCellValue( rowId:object, colId:object, val:object, autoCommit:bool );
    Return Type:
    object
    Return Type Description:
    . The transaction object that was created.

    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.
  • &nbspsort

    .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.
  • &nbspsortSettings

    .sortSettings( [s:object] );

    Gets/sets a list of paging settings.

    • s
    • Type:object
    • Optional
    • object holding all sorting settings. See settings.sorting.
  • &nbspstringToJSONObject

    .stringToJSONObject( s:string );

    Parses the string and returns an evaluated JSON object.

    • s
    • Type:string
    • the JSON as string.
  • &nbspstringToXmlObject

    .stringToXmlObject( s:string );

    Parses a string and returns a XML Document.

    • s
    • Type:string
    • the XML represented as a string.
  • &nbspsummariesResponse

    .summariesResponse( key:object, dsObj:object );

    Get summaries calculation data from remote response.

    • key
    • Type:object
    • dsObj
    • Type:object
  • &nbspsummariesSettings

    .summariesSettings( [s:object] );

    Gets/sets a list of summaries settings.

    • s
    • Type:object
    • Optional
    • object holding all summaries settings. See settings.summaries.
  • &nbsptableToObject

    .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.
  • &nbsptotalLocalRecordsCount

    .totalLocalRecordsCount( );
    Return Type:
    number
    Return Type Description:
    the number of records that are bound / exist locally.

    Returns the total number of records in the local data source.

  • &nbsptotalRecordsCount

    .totalRecordsCount( [count:number], key:object, dsObj:object, context:object );

    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 filtering 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.
    • key
    • Type:object
    • dsObj
    • Type:object
    • context
    • Type:object
  • &nbsptransactionsAsString

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

  • &nbsptransformedData

    .transformedData( transformedExecution:object );
    Return Type:
    object

    Returns transformed data according to transformed execution:
    1. Before paging and filtering
    2. After filtering before paging
    3. After filtering and paging
    .

    • transformedExecution
    • Type:object
  • &nbsptype

    .type( [t:object] );

    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:object
    • Optional
    • .
  • &nbspupdateRow

    .updateRow( rowId:object, rowObject:object, autoCommit:bool );
    Return Type:
    object
    Return Type Description:
    . The transaction object that was created.

    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.

Copyright © 1996 - 2024 Infragistics, Inc. All rights reserved.

#