Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
Bind Dynamic Object to Grid.
posted

Hi,

Is it possible to bind a dynamic object to the WinUI Html grid?  If so can you modify the Bind to JSON example.

Something like this in javascript?

var parsedValue = JsonValue.Parse({\"name\":\"Willem\"}");

var parsedObject = parsedValue.GetObject();

var firstName = parsedObject["name"].GetSting();

Thanks

Rich

  • 29417
    Offline posted

     Hello rich0809,

     

    I’m just following up to see if you’ve been able to resolve your issue. If you have any questions or concerns or if you need further assistance please let me know.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://ko.infragistics.com/support

     

  • 29417
    Offline posted

    Hello Rich,

     

    Thank you for posting in our forum.

     

    If you mean as a data source you would need to make sure that the data is parsed into one of the supported data types for the grid.

     

    Local:

    ◦JSON

    ◦XML

    ◦JavaScript Object Arrays

    ◦Strings of XML or JSON

    ◦JavaScript functions returning data in any of the formats above

    ◦Existing HTML structures (such as a HTML table filled with data)

     

    Remote:

    ◦REST GET

    ◦WCF REST (JSON & XML)

    ◦JSONP Service

    ◦Any REST Service

     

    For more details you can refer to the following article:

    http://help.infragistics.com/doc/jQuery/2014.1/CLR4.0/?page=igGrid_igDataSource_Architecture_Overview.html

     

    If you need to bind some other option of the grid you could do so by defining a new namespace with the properties and settings you want and then applying it to the grid via the namespace.

    For example:

    <code>

    var data = [{ "OrderID": 10285, "ProductID": 1, "UnitPrice": "14.4000", "Quantity": 45, "Discount": 0.2 }, { "OrderID": 10294, "ProductID": 1, "UnitPrice": "14.4000", "Quantity": 18, "Discount": 0 }];

      

        WinJS.Namespace.define("Sample.Data", {

            data: data,

            heightInPx: "50px"

        });

    </code>

     

    And then use them in the grid:

      <table id="Table1" data-win-control="Infragistics.UI.Grid"

                           data-win-options='{

                        autoGenerateColumns: false,

                        columns: [{headerText:"OrderID", key:"OrderID"},{headerText:"UnitPrice",key:"UnitPrice"},

                                  {headerText:"Quantity",key:"Quantity"} ,{headerText:"Discount",key:"Discount"}

                        ],

                        dataSource:  Sample.Data.data,

                        dataSourceType: "json",

                        width: "100%",

                        height: Sample.Data.heightInPx,

     

    Let me know if you have any questions or concerns regarding this.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer II

    Infragistics, Inc.

    http://ko.infragistics.com/support