jQWidgets Forums

jQuery UI Widgets Forums Angular Angular 2 DataAdapter

This topic contains 3 replies, has 4 voices, and was last updated by  Peter Stoev 8 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Angular 2 DataAdapter #91135

    jfabian
    Participant

    I was following the example code but not sure how it is working since I get error that $.jqx.dataAdapter is undefined when creating a property of the class but seems to work in ngAfterViewInit()? I’m not sure if it is because of the demo.js file has some code in it so this work or not.

    This does NOT work

    source: any =
        {
            datatype: "xml",
            datafields: [
                { name: 'ProductName', type: 'string' },
                { name: 'QuantityPerUnit', type: 'int' },
                { name: 'UnitPrice', type: 'float' },
                { name: 'UnitsInStock', type: 'float' },
                { name: 'Discontinued', type: 'bool' }
            ],
            root: "Products",
            record: "Product",
            id: 'ProductID',
            url: "../sampledata/products.xml"
        };
    
        dataAdapter: any = new $.jqx.dataAdapter(this.source);  <----This is undefined
    
    

    This does work:

    dataAdapter: any:
    
    ngAfterViewInit(){
      this.dataAdapter = new $.jqx.dataAdapter(this.gridSource);
    }
    Angular 2 DataAdapter #91157

    Ivo Zhulev
    Participant

    Hi jfabian,

    The first one as it is used in our demos should work. Maybe this strange behaviour is caused by some other code?

    Best Regards,
    Ivo

    jQWidgets Team
    http://www.jqwidgets.com/

    Angular 2 DataAdapter #92142

    reva
    Participant

    Hi jfabian,

    I am trying to get the sample grid to work in angular2. Can you please post your solution and also the products.xml file which you used for the project.

    Thanks,
    Reva

    Angular 2 DataAdapter #92167

    Peter Stoev
    Keymaster

    Hi Reva,

    All Angular 2 related samples are included in the download package as well as the sampledata files used. The folder of the data files is called sampledata and can be found in the demos folder.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.