Ignite UI API Reference

ig.RemoteDataSource

ig.RemoteDataSource_image

The RemoteDataSource extends the DataSource class and sets the type option to 'remoteUrl' by default. For more details on the RemoteDataSource 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 RemoteDataSource 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 RemoteDataSource 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 remoteDataSource = new $.ig.RemoteDataSource({
            responseDataType: "jsonp",
            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
            responseDataKey: "d"
        });

        $("#gridRemoteJSON").igHierarchicalGrid({
            odata: false,
            initialDataBindDepth: 1,
            dataSource: remoteDataSource,
            responseDataKey: 'd',

            autoGenerateColumns: false,
            primaryKey: "ID",
            columns: [
				{ headerText: "ID", key: "ID", width: "50px", dataType: "number" },
				{ headerText: "Name", key: "Name", width: "130px", dataType: "string" }
			],
            autoGenerateLayouts: false,
            defaultChildrenDataProperty: "Products",
            columnLayouts: [
				{
				    name: "Products",
				    responseDataKey: 'd',
				    childrenDataProperty: "Products",
				    autoGenerateColumns: false,
				    primaryKey: "ID",
				    columns: [
						{ key: "ID", headerText: "ID", width: "25px" },
						{ key: "Name", headerText: "Product Name", width: "90px" },
						{ key: "Price", headerText: "Price", dataType: "number", width: "55px" }
					]
				}
			]
        });
    });
    </script>
</head>
<body>
    <table id="gridRemoteJSON"></table>
</body>
</html>
    

Related Samples

Related Topics

Dependencies

jquery-1.4.4.js
infragistics.util.js
  • &nbsp;settings

    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.

    Code Sample

      
    var render = function (success, error) {
    	if (success) {
        var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
        resultHtml = $.ig.tmpl(template, ds.dataView());
        $("#table").html(resultHtml);
    
    	} else {
    		alert(error);
    	}
    }
    
    $(function () {
    	var ds = new $.ig.RemoteDataSource({
    		    callback: render,
    		    dataSource: "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?",
    		    schema: {
    			    fields: [{
    				    name: "Name"
    			    }, {
    				    name: "Price"
    			    }, {
    				    name: "Rating"
    			    }],
    			    searchField: "d"
    		    },
    		    responseDataKey: "d",
    		    responseDataType: "jsonp",
    		    filtering: {
    			    type: "remote",
    			    filterExprUrlKey: "filter",
    			    expressions: [{
    				    fieldName: "Name",
    				    cond: "Contains",
    				    expr: "Cr"
    			    }]
    		    },
    		    paging: {
    			    enabled: true,
    			    pageSize: 3,
    			    type: "local"
    		    }
    	    });
    	ds.dataBind();
    
    }); 
    • 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.

      Code Sample

       
      				var ds = new $.ig.RemoteDataSource({
      	              aggregateTransactions: true,
                        dataSource: arrayOfObjects
                      });
      		  
    • 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

       
      var ds = new $.ig.RemoteDataSource({
      	autoCommit: true
      }); 
                      
    • callback

      Type:
      function
      Default:
      null

      Callback function to call when data binding is complete.

      Code Sample

       
      var render = function (success, error) {
      	if (success) {
      		alert("success");
      	} else {
      		alert(error);
      	}
      }
      		
      $(function () {			
      	var ds = new $.ig.RemoteDataSource({ 
      		    callback: render, 
      		    dataSource: "http://odata.netflix.com/Catalog/Titles?$format=json&$callback=?",
      		    responseDataKey : "d.results", 
      		    responseDataType: "jsonp", 
      	    });
      	ds.dataBind();			
      }); 
                      
    • callee

      Type:
      object
      Default:
      null

      Object on which to invoke the callback function.

      Code Sample

       
      var Bob = {
      	name: "Bob",
      	greet: function () {
      		alert("Hi, I'm " + this.name);
      	}
      };
      
      $(document).ready(function () {
      	var ds = new $.ig.RemoteDataSource({
      		dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      		responseDataKey : "d.results", 
      		responseDataType: "jsonp",
              callee: Bob,
      		callback: Bob.greet
      	});
      
      	ds.dataBind();
      }); 
              
    • data

      Type:
      array
      Default:
      []
      Elements Type:
      object

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

      Code Sample

       
                              var ds = new $.ig.RemoteDataSource({
      		                    data: normalizedArrayOfObjects
                              });
                          
    • 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.

      Code Sample

       
      var myDataBinding = function () {
          alert("myDataBinding");
      },
      
      ds = new $.ig.RemoteDataSource({
      	dataBinding: myDataBinding,
      	dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	responseDataKey : "d.results", 
      	responseDataType: "jsonp"
      });
      
                 
    • 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.

      Code Sample

       
      var myDataBound = function () {
      	alert("myDataBound")
          },
          ds = new $.ig.RemoteDataSource({
      	    dataBound: myDataBound
          });
      ds.dataBind();
      });
                      
    • 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.

      Code Sample

       
      			
      ds = new $.ig.RemoteDataSource({
      	dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	responseDataKey : "d.results", 
      	responseDataType: "jsonp"
      });
                  
    • 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]}.

      Code Sample

       
      
      
      
      ds = new $.ig.RemoteDataSource({
      	dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	responseDataKey : "d.results", 
      	responseDataType: "jsonp",
      	fields: [{
      		name: "ID",
      		type: "number"
      	}, {
      		name: "Name",
      		type: "string"
      	}, {
      		name: "Description",
      		type: "string"
      	}]
      });
              
    • filtering

      Type:
      object
      Default:
      {}

      Settings related to built-in filtering functionality.

      Code Sample

       
      var jsonDs = new $.ig.RemoteDataSource({
          filtering: { 
              type: "remote"
          }, 
          dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	responseDataKey : "d.results", 
      	responseDataType: "jsonp",				
      }).dataBind();
                 
      • 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.

        Code Sample

         
        var jsonDs = new $.ig.RemoteDataSource({
            filtering: { 
                type: "remote",
                applyToAllData: true
            }, 
            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	responseDataKey : "d.results", 
        	responseDataType: "jsonp",				
        }).dataBind();
            
      • caseSensitive

        Type:
        bool
        Default:
        false

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

        Code Sample

         
        var jsonDs = new $.ig.RemoteDataSource({
            filtering: { 
                type: "remote",
                caseSensitive: true
            }, 
            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	responseDataKey : "d.results", 
        	responseDataType: "jsonp",				
        }).dataBind();
                          
      • 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.

        Code Sample

         var ds;
        
                            var render = function (success, error) {
        		                    if (success) {
        			                    var expr = "Cr";
        			                    cond = "startsWith";
        
        			                    ds.filter([{
        				                    fieldName: "Name",
        				                    expr: expr,
        				                    cond: cond
        			                    }], true);
        
                                  var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                                  resultHtml = $.ig.tmpl(template, ds.dataView());
                                  $("#table").html(resultHtml);
        		                    } else {
        			                    alert(error);
        		                    }
        	                    }
        
        
                            var myCustomFunc = function (fieldExpression, data) {
        		                    var result = [];
        		                    result[0] = data[0];
        		                    return result;
        	                    }
        
                            $(function () {
        	                    var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
        	                    ds = new $.ig.RemoteDataSource({
        		                    callback: render,
        		                    dataSource: url,
        		                    schema: {
        			                    fields: [{
        				                    name: "Name"
        			                    }, {
        				                    name: "Price"
        			                    }, {
        				                    name: "Rating"
        			                    }],
        			                    searchField: "d"
        		                    },
        		                    responseDataKey: "d",
        		                    responseDataType: "jsonp",
        		                    filtering: {
        			                    type: "remote",
        			                    customFunc: myCustomFunc
        		                    }
        	                    });
        	                    ds.dataBind();
        
                            }); 
      • defaultFields

        Type:
        array
        Default:
        []
        Elements Type:
        object

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

        Code Sample

         
                  var url = "/demos/server/proxy.php?url=http://services.odata.org/OData/OData.svc/Products?$format=json";
        			ds = new $.ig.RemoteDataSource({
                        dataSource: url, 
        			    localSchemaTransform: false, 
                        responseDataKey: "d",
        			    filtering: {
                            defaultFields:[
                                {
                                    fieldName: "Price", 
                                    cond:"GreaterThan", 
                                    expr: 20
                                }
                            ]
                        },
        			    schema: {
                            fields: [
                                { name : "Price" }, 
                                { name : "Name" }, 
                                { name: "Rating" }
                            ], 
                            searchField: "d"
                        }
        			});
        			
        			ds.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).

        Code Sample

         
                  var url = "/demos/server/proxy.php?url=http://services.odata.org/OData/OData.svc/Products?$format=json";
        			ds = new $.ig.RemoteDataSource({
                        dataSource: url, 
        			    localSchemaTransform: false, 
                        responseDataKey: "d",
        			    filtering: {
                            expressions:[
                                {
                                    fieldName: "Price", 
                                    cond:"GreaterThan", 
                                    expr: 20
                                }
                            ]
                        },
        			    schema: {
                            fields: [
                                { name : "Price" }, 
                                { name : "Name" }, 
                                { name: "Rating" }
                            ], 
                            searchField: "d"
                        }
        			});
        			
        			ds.dataBind(); 
      • exprString

        Type:
        string
        Default:
        ""

        An "SQL-like' encoded expressions string. Takes precedence over "expressions". Example: col2 > 100; col2 LIKE %test%.

        Code Sample

         var render = function (success, error) {
        		                    if (success) {
                                  var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                                  resultHtml = $.ig.tmpl(template, ds.dataView());
                                  $("#table").html(resultHtml);
        
        		                    } else {
        			                    alert(error);
        		                    }
        	                    }
        
                            var ds;
        
                            $(function () {
        	                    ds = new $.ig.RemoteDataSource({
        		                    callback: render,
        		                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                        responseDataKey : "d.results", 
        	                        responseDataType: "jsonp",
        		                    schema: {
        			                    fields: [{
        				                    name: "Name"
        			                    }, {
        				                    name: "Price"
        			                    }, {
        				                    name: "Rating"
        			                    }],
        			                    searchField: "d"
        		                    },
        		                    filtering: {
        			                    type: "remote",
        			                    exprString: "Name LIKE Cr%"
        		                    }
        	                    });
        	                    ds.dataBind();
                            }); 
      • 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.

        Code Sample

         var render = function (success, error) {
        		                    if (success) {
                                  var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                                  resultHtml = $.ig.tmpl(template, ds.dataView());
                                  $("#table").html(resultHtml);
        
        		                    } else {
        			                    alert(error);
        		                    }
        	                    }
        
                            var ds;
        
                            $(function () {
        	                    var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
        	                    ds = new $.ig.RemoteDataSource({
        		                    callback: render,
        		                    dataSource: url,
        		                    schema: {
        			                    fields: [{
        				                    name: "Name"
        			                    }, {
        				                    name: "Price"
        			                    }, {
        				                    name: "Rating"
        			                    }],
        			                    searchField: "d"
        		                    },
        		                    responseDataKey: "d",
        		                    responseDataType: "jsonp",
        		                    filtering: {
        			                    type: "remote",
        			                    filterExprUrlKey: "filter",
        			                    expressions: [{
        				                    fieldName: "Name",
        				                    cond: "Contains",
        				                    expr: "Cr"
        			                    }]
        		                    }
        	                    });
        	                    ds.dataBind();
                            }); 
      • filterLogicUrlKey

        Type:
        string
        Default:
        filterlogic

        Url key that will be encoded in the request, specifying if the filtering logic will be AND or OR.

        Code Sample

         var render = function (success, error) {
        		                    if (success) {
                                  var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                                  resultHtml = $.ig.tmpl(template, ds.dataView());
                                  $("#table").html(resultHtml);
        
        		                    } else {
        			                    alert(error);
        		                    }
        	                    }
        
                            var ds;
        
                            $(function () {
        	                    var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
        	                    ds = new $.ig.RemoteDataSource({
        		                    callback: render,
        		                    dataSource: url,
        		                    schema: {
        			                    fields: [{
        				                    name: "Name"
        			                    }, {
        				                    name: "Price"
        			                    }, {
        				                    name: "Rating"
        			                    }],
        			                    searchField: "d"
        		                    },
        		                    responseDataKey: "d",
        		                    responseDataType: "jsonp",
        		                    filtering: {
        			                    type: "remote",
        			                    filterLogicUrlKey: "testFilterLogicUrlKey",
        			                    expressions: [{
        				                    fieldName: "Name",
        				                    cond: "Contains",
        				                    expr: "Cr",
        				                    logic: "OR"
        			                    }]
        		                    }
        	                    });
        	                    ds.dataBind();
                            }); 
      • 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.

        Code Sample

         
                     jsonDs = new $.ig.RemoteDataSource({
                        filtering: { 
                            type: "local",
                            caseSensitive: true,
                            applyToAllData: true
                        }, 
                        dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	            responseDataKey : "d.results", 
        	            responseDataType: "jsonp"			
        			}).dataBind(); 
    • 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.

      Code Sample

       var ds = $.ig.RemoteDataSource({
      	                id: "myId"
                      }); 
    • localSchemaTransform

      Type:
      bool
      Default:
      true

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

      Code Sample

       
                  var ds = new $.ig.RemoteDataSource({
                      dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	            responseDataKey : "d.results", 
      	            responseDataType: "jsonp", 
      			    localSchemaTransform: false, 
                      responseDataKey: "d"
                  });
      			 
    • 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.

      Code Sample

       var render = function (success, error) {
      		                if (success) {
                            var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                            resultHtml = $.ig.tmpl(template, ds.dataView());
                            $("#table").html(resultHtml);
      
      		                } else {
      			                alert(error);
      		                }
      	                }
                      var ds;
                      $(function () {
      	                var ds = new $.ig.RemoteDataSource({
      		                callback: render,
      		                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                    responseDataKey : "d.results", 
      	                    responseDataType: "jsonp",
      		                schema: {
      			                fields: [{
      				                name: "Name"
      			                }, {
      				                name: "Price"
      			                }, {
      				                name: "Rating"
      			                }],
      			                searchField: "d"
      		                },
      		                outputResultsName: "myOutputResultsName"
      	                });
      	                ds.dataBind();
                      }); 
    • paging

      Type:
      object
      Default:
      {}

      Settings related to built-in paging functionality.

      Code Sample

       $(function () {
      					ds = new $.ig.RemoteDataSource({
      						dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                    responseDataKey : "d.results", 
      	                    responseDataType: "jsonp", 
      						paging: {
      							enabled : true, 
      							pageSize: 5, 
      							type: "local" 
      						}
      					});
      					
      					ds.dataBind();			
      				}); 
      • appendPage

        Type:
        bool
        Default:
        false

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

        Code Sample

         
                       var ds = new $.ig.RemoteDataSource({
        						    dataSource: products,  
        						    paging: {
        							    enabled: true,
        								appendPage : true
        						    }
        				        }); 
        			  
      • enabled

        Type:
        bool
        Default:
        false

        Paging is not enabled by default.

        Code Sample

         ds = new $.ig.RemoteDataSource({
        						type: "json", 
        						dataSource: adventureWorks, 
        						responseDataKey: "Records", 
        						paging: {
        							enabled : true
        						}
        					}); 
      • pageIndex

        Type:
        number
        Default:
        0

        Current page index.

        Code Sample

         
                          ds = new $.ig.RemoteDataSource({
        	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                responseDataKey : "d.results", 
        	                responseDataType: "jsonp",
        					paging: 
                            {
                                enabled : true,
                                pageIndex: 2
                            }
                        });
        			    
      • pageIndexUrlKey

        Type:
        string
        Default:
        null

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

        Code Sample

         
                             var ds = new $.ig.RemoteDataSource({
        	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results",
        	                    responseDataType: "jsonp",
        	                    paging: {
        		                    enabled: true,
        		                    pageIndex: 2,
        		                    pageIndexUrlKey: "myPageIndexUrlKey"
        	                    }
                            }); 
      • pageSize

        Type:
        number
        Default:
        5

        Number of records on each page.

        Code Sample

         ds = new $.ig.RemoteDataSource({
        	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results", 
        	                    responseDataType: "jsonp",
        						paging: {
        							enabled : true, 
        							pageSize: 5
        						}
        					}); 
      • pageSizeUrlKey

        Type:
        string
        Default:
        null

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

        Code Sample

         var ds = new $.ig.RemoteDataSource({
        	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results", 
        	                    responseDataType: "jsonp",
         	                    paging: {
         		                    enabled: true,
         		                    pageSize: 5,
         		                    pageSizeUrlKey: "myPageSizeUrlKey",
         	                    }
                             }); 
      • 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.

        Code Sample

         ds = new $.ig.RemoteDataSource({
        	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results", 
        	                    responseDataType: "jsonp", 
        						paging: {
        							enabled : true, 
        							type: "local" 
        						}
        					}); 
    • primaryKey

      Type:
      string
      Default:
      null

      The unique field identifier.

      Code Sample

       $(function () {
      					ds = new $.ig.RemoteDataSource({
                              primaryKey: "CustomerID",
      	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                    responseDataKey : "d.results", 
      	                    responseDataType: "jsonp"
      					});
      					
      					ds.dataBind();			
      			    }); 
    • requestType

      Type:
      string
      Default:
      get

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

      Code Sample

       
                          var ds = new $.ig.RemoteDataSource({
      	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                    responseDataKey : "d.results", 
      	                    responseDataType: "jsonp",
                              requestType: "get",
       	                    responseContentType: "text/javascript;charset=utf-8"
                          });
                          
    • responseContentType

      Type:
      string
      Default:
      null

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

      Code Sample

       var ds = new $.ig.RemoteDataSource({
      	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                responseDataKey : "d.results", 
      	                responseDataType: "jsonp",
       	                responseContentType: "text/javascript;charset=utf-8"
                       }); 
    • responseDataKey

      Type:
      string
      Default:
      null

      Property in the response which specifies where the data records array will be held (if the response is wrapped).

      Code Sample

       
                      var ds = new $.ig.RemoteDataSource({
      	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                responseDataKey : "d.results", 
      	                responseDataType: "jsonp"
                       });
                    
                    
    • 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

      Code Sample

       
                      var ds = new $.ig.RemoteDataSource({
      	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                responseDataKey : "d.results", 
      	                responseDataType: "jsonp"
                      });		
      				 
    • responseTotalRecCountKey

      Type:
      string
      Default:
      null

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

      Code Sample

       
                      var ds = new $.ig.RemoteDataSource({
      	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                responseDataKey : "d.results", 
      	                responseDataType: "jsonp",
       	                responseTotalRecCountKey: "9"
                       }); 
    • 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.

      Code Sample

       $.ig.RemoteDataSource({
                              rowAdded: function (item, 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.

      Code Sample

        $.ig.RemoteDataSource({
                              rowDeleted: function (item, 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.

      Code Sample

       $.ig.RemoteDataSource({
                              rowInserted: function (item, 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.

      Code Sample

       $.ig.RemoteDataSource({
                              rowUpdated: function (item, dataSource) {…}    
                           }); 
    • schema

      Type:
      object
      Default:
      null

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

      Code Sample

       
                    var jsonSchema = new $.ig.DataSchema("json", { fields: [ 
      				{ name: "ID", type: "number" },
      				{ name: "Name", type: "string" },
      				{ name: "Rating", type: "string" }],  
      				    searchField: "d.results" });
      			
      				ds = new $.ig.RemoteDataSource({
                          dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                responseDataType: "jsonp" 
                          schema: jsonSchema
                      });
      				ds.dataBind(); 
    • 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.

      Code Sample

       $.ig.RemoteDataSource({
                              serializeTransactionLog: false
                           }); 
    • sorting

      Type:
      object
      Default:
      {}

      Settings related to built-in sorting functionality.

      Code Sample

       $(function () {
      					ds = new $.ig.RemoteDataSource({
                              dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                    responseDataKey : "d.results", 
      	                    responseDataType: "jsonp"
                              sorting: {
                                  type: "local",
                                  caseSensitive: true
                              }   
      					});
      					
      					ds.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.

        Code Sample

         
                          jsonDs = new $.ig.RemoteDataSource({
                            sorting: { 
                                type: "local", 
                                applyToAllData: true
                            }, 
                            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                responseDataKey : "d.results", 
        	                responseDataType: "jsonp" 
                        }).dataBind(); 
      • caseSensitive

        Type:
        bool
        Default:
        false

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

        Code Sample

         
        					        ds = new $.ig.RemoteDataSource({
                                        sorting: {
                                            type: "local",
                                            caseSensitive: true
                                        },
                                        dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                            responseDataKey : "d.results", 
        	                            responseDataType: "jsonp"
        					        });
                        
      • 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.

        Code Sample

         var render = function (success, error) {
        		                    if (success) {
                                  var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                                  resultHtml = $.ig.tmpl(template, ds.dataView());
                                  $("#table").html(resultHtml);
        
        		                    } else {
        			                    alert(error);
        		                    }
        	                    }
        
                            var myCompareFunc = function (fields, schema, reverse, convertf) {
        		                    return function (val1, val2) {
        			                    if (val1.Price > val2.Price) {
        				                    return 1;
        			                    }
        
        			                    if (val1.Price < val2.Price) {
        				                    return -1;
        			                    }
        
        			                    return 0;
        		                    }
        	                    }
        
                            var ds;
                            $(function () {
        	                    var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
        	                    ds = new $.ig.RemoteDataSource({
        		                    callback: render,
        		                    dataSource: url,
        		                    schema: {
        			                    fields: [{
        				                    name: "Name"
        			                    }, {
        				                    name: "Price"
        			                    }, {
        				                    name: "Rating"
        			                    }],
        			                    searchField: "d"
        		                    },
        		                    responseDataKey: "d",
        		                    responseDataType: "jsonp",
        		                    sorting: {
        			                    type: "local",
        			                    compareFunc: myCompareFunc,
        			                    defaultFields: [{
        				                    fieldName: "Price"
        			                    }]
        		                    }
        	                    });
        	                    ds.dataBind();
                            }); 
      • customConvertFunc

        Type:
        object
        Default:
        null

        Custom data value conversion function. Accepts a value and should return the converted value.

        Code Sample

                             
                              var render = function (success, error) {
        		                    if (success) {
                                  var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                                  resultHtml = $.ig.tmpl(template, ds.dataView());
                                  $("#table").html(resultHtml);
        
        		                    } else {
        			                    alert(error);
        		                    }
        	                    }
        
                            var myCompareFunc = function (fields, schema, reverse, convertf) {
        		                    return function (obj1, obj2) {
        			                    a = convertf(obj1);
        			                    b = convertf(obj2);
        
        			                    if (a > b) {
        				                    return 1;
        			                    }
        
        			                    if (a < b) {
        				                    return -1;
        			                    }
        
        			                    return 0;
        		                    }
        	                    }
        
                            var myCustomConvertFunc = function (obj) {
        		                    return obj.Price;
        	                    }
        
                            var ds;
                            $(function () {
        	                    var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
        	                    ds = new $.ig.RemoteDataSource({
        		                    callback: render,
        		                    dataSource: url,
        		                    schema: {
        			                    fields: [{
        				                    name: "Name"
        			                    }, {
        				                    name: "Price"
        			                    }, {
        				                    name: "Rating"
        			                    }],
        			                    searchField: "d"
        		                    },
        		                    responseDataKey: "d",
        		                    responseDataType: "jsonp",
        		                    sorting: {
        			                    type: "local",
        			                    compareFunc: myCompareFunc,
        			                    customConvertFunc: myCustomConvertFunc,
        			                    defaultFields: [{
        				                    fieldName: "Price"
        			                    }]
        		                    }
        	                    });
        	                    ds.dataBind();
                            }); 
      • 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.

        Code Sample

         
                              var render = function (success, error) {
        		                    if (success) {
                                  var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                                  resultHtml = $.ig.tmpl(template, ds.dataView());
                                  $("#table").html(resultHtml);
        
        		                    } else {
        			                    alert(error);
        		                    }
        	                    }
        
                            var myCustomFunc = function (data, fields, direction) {
        		                    function myCompareFunc(obj1, obj2) {
        			                    if (direction == "desc") {
        				                    return obj2[fields[0].fieldName] - obj1[fields[0].fieldName];
        			                    }
        
        			                    return obj1[fields[0].fieldName] - obj2[fields[0].fieldName];
        		                    }
        		                    var result = data.sort(myCompareFunc);
        		                    return result;
        	                    }
        
                            var ds;
                            $(function () {
        	                    var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
        	                    ds = new $.ig.RemoteDataSource({
        		                    callback: render,
        		                    dataSource: url,
        		                    schema: {
        			                    fields: [{
        				                    name: "Name"
        			                    }, {
        				                    name: "Price"
        			                    }, {
        				                    name: "Rating"
        			                    }],
        			                    searchField: "d"
        		                    },
        		                    responseDataKey: "d",
        		                    responseDataType: "jsonp",
        		                    sorting: {
        			                    type: "local",
        			                    customFunc: myCustomFunc,
        			                    defaultFields: [{
        				                    fieldName: "Price"
        			                    }],
        			                    defaultDirection: "desc"
        		                    }
        	                    });
        	                    ds.dataBind();
                            }); 
      • defaultDirection

        Type:
        enumeration
        Default:
        none

        Sorting direction .

        Members

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

        Code Sample

          
                          jsonDs = new $.ig.RemoteDataSource({
                            sorting: { 
                                type: "local", 
                                defaultDirection: "asc" 
                            }, 
                            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                responseDataKey : "d.results", 
        	                responseDataType: "jsonp" 
                        }).dataBind(); 
      • 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().

        Code Sample

         var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
        	                var ds = new $.ig.RemoteDataSource({
        		                dataSource: url,
        		                schema: {
        			                fields: [{
        				                name: "Name"
        			                }, {
        				                name: "Price"
        			                }, {
        				                name: "Rating"
        			                }],
        			                searchField: "d"
        		                },
        		                responseDataKey: "d",
        		                responseDataType: "jsonp",
        		                sorting: {
        			                type: "local",
        			                defaultFields: [{
        				                fieldName: "Price"
        			                }]
        		                }
        	                }); 
      • expressions

        Type:
        array
        Default:
        []
        Elements Type:
        object

        A list of sorting expressions , consisting of the following keys (and their respective values): fieldName and direction.

        Code Sample

         
                   var ds = new $.ig.RemoteDataSource({
                        dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	            responseDataKey : "d.results", 
        	            responseDataType: "jsonp"  
        			    localSchemaTransform: false, 			
        			    sorting: {
                            expressions:[
                                {
                                    fieldName:"Rating", 
                                    dir:"asc"}, 
                                {
                                    fieldName:"Price", dir:"asc"
                                }
                            ]},
        			});
        			
      • exprString

        Type:
        string
        Default:
        ""

        Takes precedence over experssions, an "SQL-like" encoded expressions string : see sort(). Example col2 > 100 ORDER BY asc.

        Code Sample

         
                    function sortRemote() {			
        			    ds.settings.sorting.type = "remote";
        			
        			    // remote sort
        			    ds.settings.sorting.exprString = "GNP " + dir;
        			    ds.dataBind();			
        		    } 
      • sortUrlAscValueKey

        Type:
        string
        Default:
        null

        URL param value for ascending type of sorting. Default is null and uses OData conventions.

        Code Sample

         
        	                var ds = new $.ig.RemoteDataSource({
        		                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results", 
        	                    responseDataType: "jsonp",
        		                sorting: {
        			                type: "local",
        			                sortUrlAscValueKey: "mySortUrlAscValueKey"
        		                }
        	                }); 
      • sortUrlDescValueKey

        Type:
        string
        Default:
        null

        URL param value for descending type of sorting. Default is null and uses OData conventions.

        Code Sample

         
        	                var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
        	                var ds = new $.ig.RemoteDataSource({
        		                callback: render, 
        		                dataSource: url,
        		                schema: {
        			                fields: [
        				                {name: "Name"}, 
        				                {name: "Price"}, 
        				                {name: "Rating"}
        			                ], 
        			                searchField: "d"
        		                },
        		                responseDataKey: "d", 
        		                responseDataType: "jsonp",
        		                sorting: {
        			                type: "local",
        			                sortUrlDescValueKey: "mySortUrlDescValueKey"
        		                }  
        	                });
                                    
      • 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.

        Code Sample

        	                var ds = new $.ig.RemoteDataSource({
        		                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results", 
        	                    responseDataType: "jsonp", 
        		                sorting: {
        			                type: "local",
        			                sortUrlDescValueKey: "mySortUrlDescValueKey"
        		                }  
        	                }); 
      • 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

        Code Sample

                                 
        					        ds = new $.ig.RemoteDataSource({
        						        dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                            responseDataKey : "d.results", 
        	                            responseDataType: "jsonp" 
                                        sorting: {
                                            type: "local",
                                            caseSensitive: true
                                        }   
        					        });
        					
        					        	 
    • summaries

      Type:
      object
      Default:
      {}

      Settings related to built-in summaries functionality.

      Code Sample

               
      	            var ds = new $.ig.RemoteDataSource({
      		            schema: {
      			            fields: [{
      				            name: "Name"
      			            }, {
      				            name: "Price"
      			            }, {
      				            name: "Rating"
      			            }],
      			            searchField: "d"
      		            },
      		            summaries: {
      			            type: "remote",
      			            columnSettings: [{
      				            columnKey: "Price",
      				            allowSummaries: false,
      				            summaryOperands: [{
      					            type: "count",
      					            active: true,
      					            order: 0
      				            }]
      			            }],
      			            summariesResponseKey: "d"
      		            },
                          dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                responseDataKey : "d.results", 
      	                responseDataType: "jsonp" 
      	            }); 
      • columnSettings

        Type:
        array
        Default:
        []
        Elements Type:
        object

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

        Code Sample

                             
                            var ds = new $.ig.RemoteDataSource({
        	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results", 
        	                    responseDataType: "jsonp" 
        	                    summaries: {
        		                    columnSettings: [{
        			                    columnKey: "Price",
        			                    allowSummaries: false,
        			                    summaryOperands: [{
        				                    type: "count",
        				                    active: true,
        				                    order: 0
        			                    }]
        		                    }]
        	                    }
        
                            }); 
      • summariesResponseKey

        Type:
        string
        Default:
        summaries

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

        Code Sample

                             
                            var ds = new $.ig.RemoteDataSource({
        	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results", 
        	                    responseDataType: "jsonp" 
        	                    summaries: {
        		                    summariesResponseKey: "d"
        	                    }
        
                            }); 
      • summaryExecution

        Type:
        enumeration
        Default:
        afterfilteringandpaging

        Determines when the summary values are calculated .

        Members

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

        Code Sample

                            var ds = new $.ig.RemoteDataSource({
        	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results", 
        	                    responseDataType: "jsonp" 
        	                    summaries: {
        		                    summaryExecution: "priortofilteringandpaging"
        	                    }
        
                            }); 
      • summaryExprUrlKey

        Type:
        string
        Default:
        summaries

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

        Code Sample

                            var ds = new $.ig.RemoteDataSource({
        	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results", 
        	                    responseDataType: "jsonp",
        	                    summaries: {
        		                    summaryExprUrlKey: "mySummaries"
        	                    }
                            }); 
      • 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.

        Code Sample

         var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
        	                var ds = new $.ig.RemoteDataSource({
        		                summaries: {
        			                type: "remote"
        		                },
                                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
        	                    responseDataKey : "d.results", 
        	                    responseDataType: "jsonp" 
        	                }); 
    • 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

      Code Sample

       		
      					ds = new $.ig.RemoteDataSource({
      	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
      	                    responseDataKey : "d.results", 
      	                    responseDataType: "jsonp" 
      					});			
                  
    • updateUrl

      Type:
      string
      Default:
      null

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

      Code Sample

      	            var ds = new $.ig.RemoteDataSource({
      		            updateUrl: "http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?", 
      	            }); 
    • 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.

      Code Sample

       
                        var render = function (success, error) {
      		                if (success) {
                            var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                            resultHtml = $.ig.tmpl(template, ds.dataView());
                            $("#table").html(resultHtml);
      
      		                } else {
      			                alert(error);
      		                }
      	                }
      
                      var myUrlParamsEncoded = function (item, params) {
      		                alert("myUrlParamsEncoded");
      	                }
      
                      var ds;
                      $(function () {
      	                var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
      	                ds = new $.ig.RemoteDataSource({
      		                callback: render,
      		                dataSource: url,
      		                schema: {
      			                fields: [{
      				                name: "Name"
      			                }, {
      				                name: "Price"
      			                }, {
      				                name: "Rating"
      			                }],
      			                searchField: "d"
      		                },
      		                responseDataKey: "d",
      		                responseDataType: "jsonp",
      		                urlParamsEncoded: myUrlParamsEncoded
      	                });
      	                ds.dataBind();
                      }); 
    • 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.

      Code Sample

       
                        var render = function (success, error) {
      		                if (success) {
                            var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                            resultHtml = $.ig.tmpl(template, ds.dataView());
                            $("#table").html(resultHtml);
      
      		                } else {
      			                alert(error);
      		                }
      	                }
      
                      var myUrlParamsEncoding = function (item, params) {
      		                alert("myUrlParamsEncoding");
      	                }
      
                      var ds;
                      $(function () {
      	                var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
      	                ds = new $.ig.RemoteDataSource({
      		                callback: render,
      		                dataSource: url,
      		                schema: {
      			                fields: [{
      				                name: "Name"
      			                }, {
      				                name: "Price"
      			                }, {
      				                name: "Rating"
      			                }],
      			                searchField: "d"
      		                },
      		                responseDataKey: "d",
      		                responseDataType: "jsonp",
      		                urlParamsEncoding: myUrlParamsEncoding
      	                });
      	                ds.dataBind();
                      }); 
The current widget has no events.
  • &nbsp;ig.RemoteDataSource

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

    • options
    • Type:object

    Code Sample

     var remoteDataSource = new $.ig.RemoteDataSource({
    	                    responseDataType: "jsonp",
    	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	                    responseDataKey: "d"
                        });
     
  • &nbsp;addNode

    .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.
  • &nbsp;addRow

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

    Code Sample

     var ds;
    
                var render = function (success, error) {
    	            if (success) {
    		
    		            ds.addRow(123, {Name : "CD Player", Price : "40", Rating : "4"}, true);
                    var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                    resultHtml = $.ig.tmpl(template, ds.dataView());
                    $("#table").html(resultHtml);
    	            } else {
    		            alert(error);
    	            }
                }
    
    
    
                $(function () {
    	            var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
    	            ds = new $.ig.RemoteDataSource({
    		            callback: render, 
    		            dataSource: url,
    		            schema: {
    			            fields: [
    				            {name: "Name"}, 
    				            {name: "Price"}, 
    				            {name: "Rating"}
    			            ], 
    			            searchField: "d"
    		            },
    		            responseDataKey: "d", 
    		            responseDataType: "jsonp"
    	            });
    	            ds.dataBind();	
    
                });       
  • &nbsp;allTransactions

    .allTransactions( );
    Return Type:
    array

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

    Code Sample

     var ds;
    
                var render = function (success, error) {
    		            if (success) {
    
    			            ds.addRow(123, {
    				            Name: "CD Player",
    				            Price: "40",
    				            Rating: "4"
    			            }, true);
    			            console.log(ds.allTransactions());
                      var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                      resultHtml = $.ig.tmpl(template, ds.dataView());
                      $("#table").html(resultHtml);
    
    		            } else {
    			            alert(error);
    		            }
    	            }
    
    
    
                $(function () {
    	            var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
    	            ds = new $.ig.RemoteDataSource({
    		            callback: render,
    		            dataSource: url,
    		            schema: {
    			            fields: [{
    				            name: "Name"
    			            }, {
    				            name: "Price"
    			            }, {
    				            name: "Rating"
    			            }],
    			            searchField: "d"
    		            },
    		            responseDataKey: "d",
    		            responseDataType: "jsonp"
    	            });
    	            ds.dataBind();
    
                });  
  • &nbsp;analyzeDataSource

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

    Code Sample

     var ds;
    
                var render = function (success, error) {
    		            if (success) {
    
    			            console.log(ds.analyzeDataSource());
                      var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                      resultHtml = $.ig.tmpl(template, ds.dataView());
                      $("#table").html(resultHtml);
    
    		            } else {
    			            alert(error);
    		            }
    	            }
    
                $(function () {
    	            var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
    	            ds = new $.ig.RemoteDataSource({
    		            callback: render,
    		            dataSource: url,
    		            schema: {
    			            fields: [{
    				            name: "Name"
    			            }, {
    				            name: "Price"
    			            }, {
    				            name: "Rating"
    			            }],
    			            searchField: "d"
    		            },
    		            responseDataKey: "d",
    		            responseDataType: "jsonp"
    	            });
    	            ds.dataBind();
                }); 
  • &nbsp;clearLocalFilter

    .clearLocalFilter( );

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

    Code Sample

     
    		ds.clearLocalFilter();
    	  
  • &nbsp;clearLocalSorting

    .clearLocalSorting( );

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

    Code Sample

     
    		ds.clearLocalSorting();
    	  
  • &nbsp;commit

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

    Code Sample

     var ds;
    
                var render = function (success, error) {
    		            if (success) {
    
    			            ds.addRow(123, {
    				            Name: "CD Player",
    				            Price: "40",
    				            Rating: "4"
    			            });
    			            ds.commit();
                      var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                      resultHtml = $.ig.tmpl(template, ds.dataView());
                      $("#table").html(resultHtml);
    
    		            } else {
    			            alert(error);
    		            }
    	            }
    
                $(function () {
    	            var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
    	            ds = new $.ig.RemoteDataSource({
    		            callback: render,
    		            dataSource: url,
    		            schema: {
    			            fields: [{
    				            name: "Name"
    			            }, {
    				            name: "Price"
    			            }, {
    				            name: "Rating"
    			            }],
    			            searchField: "d"
    		            },
    		            responseDataKey: "d",
    		            responseDataType: "jsonp"
    	            });
    
    	            ds.dataBind();
                }); 
  • &nbsp;data

    .data( );
    Return Type:
    object

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

    Code Sample

              var ds;
                var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
                ds = new $.ig.RemoteDataSource({
    	            dataSource: url,
    	            schema: {
    		            fields: [{
    			            name: "Name"
    		            }, {
    			            name: "Price"
    		            }, {
    			            name: "Rating"
    		            }],
    		            searchField: "d"
    	            },
    	            responseDataKey: "d",
    	            responseDataType: "jsonp"
                });
    
                var data = ds.data();  
  • &nbsp;dataBind

    .dataBind( [callback:string], [callee:object] );

    Data binds to the current data source data source
    databinding works using the following workflow:
    1. fire the databinding event
    2. based on the data source type (see analyzeDataSource()), do the following:
    3. if type is HtmlTable, parse the table and set the data and dataView respectively.
    if the type is Function, call it, apply Paging/Filtering/Sorting, and set this._dataView . If the developer wants to do his own paging, filtering or sorting
    in that case, then he should handle the PageIndexChanging and/or DataFiltering, and/or ColumnSorting client-side events, and cancel them.
    if no paging/sorting/filtering are enabled, use just this._data to save space
    if the data source is of type RemoteUrl, use jQuery's $.ajax API to trigger a remote request to the service. Use the param() API to encode the URL
    if the data source is invalid, throw an exception
    if the analyzed runtime data source type , that is, the result of analyzeDataSource(), is Unknown, check if
    the value of settings.type is set to XML or JSON. If string, eval for JSON, and parse for the XML to build the object ree
    4. now normalize/transform the data, if a schema is supplied. This inplies any additional data type conversion
    5. next, if OpType is Local, apply paging, sorting, and/or filtering to the data, and store the result in this._dataView
    6. fire the databound event
    .

    • callback
    • Type:string
    • Optional
    • callback function .
    • callee
    • Type:object
    • Optional
    • callee object on which the callback will be executed. If none is specified, will assume global execution context.

    Code Sample

     var remoteDataSource = new $.ig.RemoteDataSource({
    	                    responseDataType: "jsonp",
    	                    dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	                    responseDataKey: "d"
                        });
    
    				    ds.dataBind(); 
  • &nbsp;dataSource

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

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

    • ds
    • Type:object
    • Optional
    • .

    Code Sample

     
    var remoteDataSource = new $.ig.RemoteDataSource({
    	responseDataType: "jsonp",
    	dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	responseDataKey: "d"
    });
    
    
    // Set
    ds.dataSource(url);
    
    // Get
    var dataSource = ds.dataSource(); 
                
  • &nbsp;dataSummaries

    .dataSummaries( );
    Return Type:
    object

    Returns summaries data.

    Code Sample

     
                var remoteDataSource = new $.ig.RemoteDataSource({
    	            responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d"
                });
    
                var dataSummaries = ds.dataSummaries(); 
  • &nbsp;dataView

    .dataView( );
    Return Type:
    object

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

    Code Sample

     var remoteDataSource = new $.ig.RemoteDataSource({
    	            responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d"
                });
    
                var dataSummaries = ds.dataView(); 
  • &nbsp;deleteRow

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

    Code Sample

     var ds;
    
                var render = function (success, error) {
    		            if (success) {
    
    			            ds.deleteRow(0, true);
    
                      var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                      resultHtml = $.ig.tmpl(template, ds.dataView());
                      $("#table").html(resultHtml);
    
    		            } else {
    			            alert(error);
    		            }
    	            }
    
    
    
                $(function () {
    	            var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
    	            ds = new $.ig.RemoteDataSource({
    		            callback: render,
    		            dataSource: url,
    		            schema: {
    			            fields: [{
    				            name: "Name"
    			            }, {
    				            name: "Price"
    			            }, {
    				            name: "Rating"
    			            }],
    			            searchField: "d"
    		            },
    		            responseDataKey: "d",
    		            responseDataType: "jsonp"
    	            });
    	            ds.dataBind();
    
                }); 
  • &nbsp;fields

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

    Code Sample

     var ds;
    
                var render = function (success, error) {
    		            if (success) {
                      var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                      resultHtml = $.ig.tmpl(template, ds.dataView());
                      $("#table").html(resultHtml);
    
    		            } else {
    			            alert(error);
    		            }
    	            }
    
                $(function () {
    	            var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
    	            ds = new $.ig.RemoteDataSource({
    		            callback: render,
    		            dataSource: url,
    		            schema: {
    			            fields: [{
    				            name: "Name"
    			            }, {
    				            name: "Price"
    			            }, {
    				            name: "Rating"
    			            }],
    			            searchField: "d"
    		            },
    		            responseDataKey: "d",
    		            responseDataType: "jsonp",
    		            fields: [{
    			            key: "Name",
    			            dataType: "string"
    		            }, {
    			            key: "Price",
    			            dataType: "number"
    		            }, {
    			            key: "Rating",
    			            dataType: "number"
    		            }]
    	            });
    	            ds.dataBind();
    	            var fields = ds.fields();
                }); 
  • &nbsp;filter

    .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

    Code Sample

     
    var remoteDataSource = new $.ig.RemoteDataSource({
    	responseDataType: "jsonp",
    	dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	responseDataKey: "d"
    });
    ds.dataBind();		
                
    ds.filter([{fieldName : "Color", expr: "Red", cond: "Equals"}], "AND", true); 
  • &nbsp;filterSettings

    .filterSettings( [f:object] );

    Gets/sets a list of filtering settings.

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

    Code Sample

     var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
                var ds = new $.ig.RemoteDataSource({
    	            dataSource: url,
    	            schema: {
    		            fields: [
    			            {name : "Name"}, 
    			            {name : "Price"}, 
    			            {name: "Rating"}
    		            ], 
    		            searchField: "d"
    	            },
    	            responseDataKey: "d", 
    	            responseDataType: "jsonp"
                });
    
                var myFilterSettings = {
    	            type: "remote",
    	            expressions: [
    		            {
    			            fieldName: "Name", 
    			            cond:"Contains", 
    			            expr: "Cr",
    			            logic: "OR"
    		            }
    	            ]
                };
    
                // Set
                ds.filterSettings(myFilterSettings); 
    
                // Get
                var filterSettings= ds.filterSettings(); 
  • &nbsp;findRecordByKey

    .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

    Code Sample

     var ds;
    
                var render = function (success, error) {
    		            if (success) {
                      var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                      resultHtml = $.ig.tmpl(template, ds.dataView());
                      $("#table").html(resultHtml);
    			            var myObj = ds.findRecordByKey("Milk");
    		            } else {
    			            alert(error);
    		            }
    	            }
    
                $(function () {
    	            var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
    	            ds = new $.ig.RemoteDataSource({
    		            callback: render,
    		            dataSource: url,
    		            schema: {
    			            fields: [{
    				            name: "Name"
    			            }, {
    				            name: "Price"
    			            }, {
    				            name: "Rating"
    			            }],
    			            searchField: "d"
    		            },
    		            responseDataKey: "d",
    		            responseDataType: "jsonp",
    		            primaryKey: "Name"
    	            });
    	            ds.dataBind();
                }); 
  • &nbsp;getDetachedRecord

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

    Code Sample

     var ds;
    
                $(function () {
    	            ds = new $.ig.RemoteDataSource({
    		            schema: {
    			            fields: [{
    				            name: "Name"
    			            }, {
    				            name: "Price"
    			            }, {
    				            name: "Rating"
    			            }],
    		            }
    	            });
    
    	            var transactionObject = ds.addRow(123, {
    		            Name: "CD Player",
    		            Price: "40",
    		            Rating: "4"
    	            }, true);
    	            var detachedObject = ds.getDetachedRecord(transactionObject);
                }); 
  • &nbsp;hasTotalRecordsCount

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

    Code Sample

     var ds;
                $(function () {
    	            var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
    	            ds = new $.ig.RemoteDataSource({
    		            dataSource: url,
    		            schema: {
    			            fields: [{
    				            name: "Name"
    			            }, {
    				            name: "Price"
    			            }, {
    				            name: "Rating"
    			            }],
    			            searchField: "d"
    		            },
    		            responseDataKey: "d",
    		            responseDataType: "jsonp",
    		            primaryKey: "Name"
    	            });
    	            ds.dataBind();
    	            // Get
    	            var hasTotalRecords = ds.hasTotalRecordsCount();
    
    	            // Set
    	            ds.hasTotalRecordsCount(true);
                }); 
  • &nbsp;insertRow

    .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

    Code Sample

     var ds;
    
                var render = function (success, error) {
    		            if (success) {
    
    			            ds.insertRow(123, {
    				            Name: "CD Player",
    				            Price: "40",
    				            Rating: "4"
    			            }, 1, true);
                      var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                      resultHtml = $.ig.tmpl(template, ds.dataView());
                      $("#table").html(resultHtml);
    
    		            } else {
    			            alert(error);
    		            }
    	            }
    
    
    
                $(function () {
    	            var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
    	            ds = new $.ig.RemoteDataSource({
    		            callback: render,
    		            dataSource: url,
    		            schema: {
    			            fields: [{
    				            name: "Name"
    			            }, {
    				            name: "Price"
    			            }, {
    				            name: "Rating"
    			            }],
    			            searchField: "d"
    		            },
    		            responseDataKey: "d",
    		            responseDataType: "jsonp"
    	            });
    	            ds.dataBind();
    
    
                }); 
  • &nbsp;metadata

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

    Code Sample

     var ds;
    
                var render = function (success, error) {
    		            if (success) {
                      var template = "<tr><td>${Name}</td><td>${Price}</td><td>${Rating}</td></tr>",
                      resultHtml = $.ig.tmpl(template, ds.dataView());
                      $("#table").html(resultHtml);
    		            } else {
    			            alert(error);
    		            }
    	            }
    
                $(function () {
    	            var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
    	            ds = new $.ig.RemoteDataSource({
    		            callback: render,
    		            dataSource: url,
    		            schema: {
    			            fields: [{
    				            name: "Name"
    			            }, {
    				            name: "Price"
    			            }, {
    				            name: "Rating"
    			            }],
    			            searchField: "d"
    		            },
    		            responseDataKey: "d",
    		            responseDataType: "jsonp",
    		            primaryKey: "Name"
    	            });
    	            ds.dataBind();
    
    	            var metadata = ds.metadata();
    
                }); 
  • &nbsp;nextPage

    .nextPage( );

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

    Code Sample

     
                    var ds = new $.ig.RemoteDataSource({
                        paging: {
                            enabled : true, 
                            pageSize: 5, 
                            type: "local" 
                        },
                        responseDataType: "jsonp",
    	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	                responseDataKey: "d"
                    });
                    
                    ds.nextPage(); 
  • &nbsp;pageCount

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

    Returns the total number of pages.

    Code Sample

     ds = new $.ig.RemoteDataSource({
                        paging: {
                            enabled : true, 
                            pageSize: 5, 
                            type: "local" 
                        },
                        responseDataType: "jsonp",
    	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	                responseDataKey: "d"
                    });
                    
                    var count = ds.pageCount(); 
  • &nbsp;pageIndex

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

    Code Sample

     ds = new $.ig.RemoteDataSource({
                        paging: {
                            enabled : true, 
                            pageSize: 5, 
                            type: "local" 
                        },
                        responseDataType: "jsonp",
    	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	                responseDataKey: "d"
                    });
                    
                    //Get
                    var currentIndex = ds.pageIndex();
                    
                    //Set
                    ds.pageIndex(5); 
  • &nbsp;pageSize

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

    Code Sample

     ds = new $.ig.RemoteDataSource({
                        paging: {
                            enabled : true, 
                            pageSize: 5, 
                            type: "local" 
                        },
                        responseDataType: "jsonp",
    	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	                responseDataKey: "d"
                    });
                    
                    //Get
                    var size = ds.pageSize();
                    
                    //Set
                    ds.pageSize(25); 
  • &nbsp;pageSizeDirty

    .pageSizeDirty( );

    For internal use.

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            paging: {
    		            enabled: true,
    		            pageSize: 5,
    		            type: "local"
    	            },
                    responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d"
                });
    
                ds.pageSizeDirty(); 
  • &nbsp;pagingSettings

    .pagingSettings( [p:object] );

    Gets/sets a list of paging settings.

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

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            paging: {
    		            enabled: true,
    		            pageSize: 5,
    		            type: "local"
    	            },
                    responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d"
                });
    
                var myPagingSettings = {
    	            enabled: true,
    	            pageSize: 5,
    	            pageIndex: 2,
    	            pageIndexUrlKey: "myPageIndexUrlKey",
    	            type: "local"
                };
    
                // Set
                ds.pagingSettings(myPagingSettings);
    
                // Get
                var pagingSettings = ds.pagingSettings(); 
  • &nbsp;pendingTransactions

    .pendingTransactions( );
    Return Type:
    array

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

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            schema: {
    		            fields: [{
    			            name: "Name"
    		            }, {
    			            name: "Price"
    		            }, {
    			            name: "Rating"
    		            }],
    		            searchField: "d"
    	            },
                    responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d"
                });
                ds.addRow(123, {
    	            Name: "CD Player",
    	            Price: "40",
    	            Rating: "4"
                });
                var pendingTransactions = ds.pendingTransactions()); 
  • &nbsp;prevPage

    .prevPage( );

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

    Code Sample

     ds = new $.ig.RemoteDataSource({
                        paging: {
                            enabled : true, 
                            pageSize: 5, 
                            type: "local" 
                        },
                        responseDataType: "jsonp",
    	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	                responseDataKey: "d"
                    });
                    
                    ds.prevPage(); 
  • &nbsp;recordsForPage

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

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            paging: {
    		            enabled: true,
    		            pageSize: 5,
    		            type: "local"
    	            },
                    responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d"
                });
    
                var recordsForPage = ds.recordsForPage(2); 
  • &nbsp;removeNode

    .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.
  • &nbsp;removeRecordByIndex

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

    Removes a record from the data source at specific index.

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

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            schema: {
    		            fields: [{
    			            name: "Name"
    		            }, {
    			            name: "Price"
    		            }, {
    			            name: "Rating"
    		            }],
    		            searchField: "d"
    	            },
    	            responseDataKey: "d",
    	            responseDataType: "jsonp"
                });
                ds.addRow(0, {
    	            Name: "CD Player",
    	            Price: "40",
    	            Rating: "4"
                }, true);
                ds.addRow(1, {
    	            Name: "CD Player1",
    	            Price: "40",
    	            Rating: "4"
                }, true);
                ds.addRow(2, {
    	            Name: "CD Player2",
    	            Price: "40",
    	            Rating: "4"
                }, true);
    
                ds.removeRecordByIndex(0); 
  • &nbsp;removeRecordByKey

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

    Removes a specific record denoted by the primaryKey of the passed key parameter from the data source.

    • key
    • Type:object
    • primary key of the record.
    • origDs
    • Type:object

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            schema: {
    		            fields: [{
    			            name: "Name"
    		            }, {
    			            name: "Price"
    		            }, {
    			            name: "Rating"
    		            }],
    		            searchField: "d"
    	            },
    	            responseDataKey: "d",
    	            responseDataType: "jsonp",
    	            primaryKey: "Name"
                });
                ds.addRow(0, {
    	            Name: "CD Player",
    	            Price: "40",
    	            Rating: "4"
                }, true);
                ds.addRow(1, {
    	            Name: "CD Player1",
    	            Price: "40",
    	            Rating: "4"
                }, true);
                ds.addRow(2, {
    	            Name: "CD Player2",
    	            Price: "40",
    	            Rating: "4"
                }, true);
    
                ds.removeRecordByKey("CD Player2"); 
  • &nbsp;rollback

    .rollback( [id:object] );

    Clears the transaction log without updating anything in the data source.

    • id
    • Type:object
    • Optional
    • Record Id to find transactions for. If no id is specified, will rollback all transactions to the data source.

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            schema: {
    		            fields: [{
    			            name: "Name"
    		            }, {
    			            name: "Price"
    		            }, {
    			            name: "Rating"
    		            }],
    		            searchField: "d"
    	            },
                    responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d",
    	            primaryKey: "Name"
                });
                ds.addRow(0, {
    	            Name: "CD Player",
    	            Price: "40",
    	            Rating: "4"
                });
                ds.addRow(1, {
    	            Name: "CD Player1",
    	            Price: "40",
    	            Rating: "4"
                });
                ds.addRow(2, {
    	            Name: "CD Player2",
    	            Price: "40",
    	            Rating: "4"
                });
    
    
                ds.rollback(); 
  • &nbsp;saveChanges

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

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            schema: {
    		            fields: [{
    			            name: "Name"
    		            }, {
    			            name: "Price"
    		            }, {
    			            name: "Rating"
    		            }]
    	            },
    	            updateUrl: "http://example.com/myUpdateUrl/"
                });
    
                ds.addRow(0, {
    	            Name: "CD Player",
    	            Price: "40",
    	            Rating: "4"
                }, true);
                ds.addRow(1, {
    	            Name: "CD Player1",
    	            Price: "40",
    	            Rating: "4"
                }, true);
                ds.addRow(2, {
    	            Name: "CD Player2",
    	            Price: "40",
    	            Rating: "4"
                }, true);
    
                ds.saveChanges(); 
  • &nbsp;schema

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

    Code Sample

     var jsonSchema = new $.ig.DataSchema("json", {
    	            fields: [{
    		            name: "ProductID",
    		            type: "number"
    	            }, {
    		            name: "Name",
    		            type: "string"
    	            }, {
    		            name: "ProductNumber",
    		            type: "string"
    	            }, {
    		            name: "Color",
    		            type: "string"
    	            }, {
    		            name: "StandardCost",
    		            type: "string"
    	            }],
    	            searchField: "Records"
                });
    
                ds = new $.ig.RemoteDataSource();
    
                // Set
                ds.schema(jsonSchema);
    
                // Get
                var myJsonSchema = ds.schema(); 
  • &nbsp;setCellValue

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

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            schema: {
    		            fields: [{
    			            name: "Name"
    		            }, {
    			            name: "Price"
    		            }, {
    			            name: "Rating"
    		            }]
    	            },
    	            updateUrl: "http://example.com/myUpdateUrl/"
                });
    
                ds.addRow(0, {
    	            Name: "CD Player",
    	            Price: "40",
    	            Rating: "4"
                }, true);
                ds.addRow(1, {
    	            Name: "CD Player1",
    	            Price: "40",
    	            Rating: "4"
                }, true);
                ds.addRow(2, {
    	            Name: "CD Player2",
    	            Price: "40",
    	            Rating: "4"
                }, true);
    
                ds.setCellValue(1, "Name", "DVD Player", true); 
  • &nbsp;sort

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

    Code Sample

     var ds = new $.ig.RemoteDataSource({ 
                    schema: { 
                        fields:[
                            { name : "col1" }, 
                            {
                                name : "col2", 
                                type: "number"
                            }
                        ]
                    }, 
    				sorting: { type: "local"}, 
                    dataSource: $("#t1")[0] 
    			}).dataBind();
                
    			ds.sort([{fieldName : "col2"}], "desc", false); 
  • &nbsp;sortSettings

    .sortSettings( [s:object] );

    Gets/sets a list of paging settings.

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

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            schema: {
    		            fields: [{
    			            name: "col1"
    		            }, {
    			            name: "col2",
    			            type: "number"
    		            }]
    	            }
                }).dataBind();
    
                var sortSettings = {
    	            type: "local",
    	            defaultFields: [{
    		            fieldName: "col2"
    	            }],
    	            defaultDirection: "desc"
                };
    
                // Set
                ds.sortSettings(sortSettings);
    
                // Get
                var mySortSettings = ds.sortSettings(); 
  • &nbsp;stringToJSONObject

    .stringToJSONObject( s:string );

    Parses the string and returns an evaluated JSON object.

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

    Code Sample

     ds = new $.ig.RemoteDataSource();
                var jsonObj = ds.stringToJSONObject('[{"Name":"CD Player","Price":10.90,"Rating":3}]'); 
  • &nbsp;stringToXmlObject

    .stringToXmlObject( s:string );

    Parses a string and returns a XML Document.

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

    Code Sample

     
                ds = new $.ig.RemoteDataSource();
                var xmlObj = ds.stringToXmlObject("<Element><Name>CD Player</Name><Price>10.90</Price><Rating>3</Rating></Element>");
                
  • &nbsp;summariesResponse

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

    Get summaries calculation data from remote response.

    • key
    • Type:object
    • dsObj
    • Type:object

    Code Sample

     
                var ds = new $.ig.RemoteDataSource();
                ds.summariesResponse("summaries", data);
                
  • &nbsp;summariesSettings

    .summariesSettings( [s:object] );

    Gets/sets a list of summaries settings.

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

    Code Sample

     var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
                var ds = new $.ig.RemoteDataSource({
    	            dataSource: url,
    	            schema: {
    		            fields: [{
    			            name: "Name"
    		            }, {
    			            name: "Price"
    		            }, {
    			            name: "Rating"
    		            }],
    		            searchField: "d"
    	            },
    	            responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d"
                });
    
                var mySummariesSettings = {
    	            type: "remote",
    	            columnSettings: [{
    		            columnKey: "Price",
    		            allowSummaries: false,
    		            summaryOperands: [{
    			            type: "count",
    			            active: true,
    			            order: 0
    		            }]
    	            }],
    	            summariesResponseKey: "d"
                };
    
                // Set
                ds.summariesSettings(mySummariesSettings);
    
                // Get
                var summariesSettings = ds.summariesSettings(); 
  • &nbsp;tableToObject

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

    Code Sample

     ds = new $.ig.RemoteDataSource();
                var tableObj = ds.tableToObject("<table><tr><td>CD Player</td><td>10.90</td><td>3</td></tr><tr><td>CD Player 1</td><td>10.90</td><td>3</td></tr><tr><td>CD Player 2</td><td>10.90</td><td>3</td></tr></table>"); 
  • &nbsp;totalLocalRecordsCount

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

    Code Sample

     ds = new $.ig.RemoteDataSource({
                        responseDataType: "jsonp",
    	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	                responseDataKey: "d"		
    			    }).dataBind();
                
                var count = ds.totalLocalRecordsCount(); 
  • &nbsp;totalRecordsCount

    .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

    Code Sample

     ds = new $.ig.RemoteDataSource({
                        responseDataType: "jsonp",
    	                dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	                responseDataKey: "d"		
    			    }).dataBind();
                
                //Get
                var count = ds.totalRecordsCount();
                
                //Set
                ds.totalRecordsCount(42); 
  • &nbsp;transactionsAsString

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

    Code Sample

     var ds = new $.ig.RemoteDataSource({
                	schema: {
                		fields: [{
                			name: "Name"
                		}, {
                			name: "Price"
                		}, {
                			name: "Rating"
                		}],
                		searchField: "d"
                	},
                	responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d"
                });
                ds.addRow(123, {
                	Name: "CD Player",
                	Price: "40",
                	Rating: "4"
                });
                var transactionsAsString = ds.transactionsAsString(); 
  • &nbsp;transformedData

    .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

    Code Sample

     var url = "http://services.odata.org/OData/OData.svc/Products?$format=json&$callback=?";
                var ds = new $.ig.RemoteDataSource({
    	            responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d"
                });
    
                ds.transformedData("priortofilteringandpaging"); 
  • &nbsp;type

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

    Code Sample

     ds = new $.ig.RemoteDataSource();
    
                // Set
                ds.type("json");
    
                // Get
                var myType = ds.type(); 
  • &nbsp;updateRow

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

    Code Sample

     var ds = new $.ig.RemoteDataSource({
    	            responseDataType: "jsonp",
    	            dataSource: 'http://services.odata.org/OData/OData.svc/Categories?$expand=Products&$format=json&$callback=?',
    	            responseDataKey: "d"
                });
                ds.addRow(0, {
    	            Name: "CD Player",
    	            Price: "40",
    	            Rating: "4"
                }, true);
                ds.addRow(1, {
    	            Name: "CD Player1",
    	            Price: "40",
    	            Rating: "4"
                }, true);
                ds.addRow(2, {
    	            Name: "CD Player2",
    	            Price: "40",
    	            Rating: "4"
                }, true);
    
    
                ds.updateRow(1, {
    	            Name: "DVD Player1",
    	            Price: "10",
    	            Rating: "5"
                }, true); 

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

#