jQWidgets Forums

jQuery UI Widgets Forums TreeGrid TreeGrid set 'source' problem

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • TreeGrid set 'source' problem #57480

    seonghye kim
    Participant

    Hi.

    When I set ‘source’ in TreeGrid, I faced the exception below.
    It throws exceptions but grid data is normally shown.

    Also another thing is …
    If I use ‘url’ + ‘datatype json’ => exceptions,
    If I use ‘localdata’ => no exceptions.

    * example : http://jsfiddle.net/KZyKp/
    (it uses ‘localdata’, so it doesn’t throw exceptions…)

    How can I solve the problem?

    ——–
    $(“#treeGrid”).jqxTreeGrid({ source : getDataSource(false) });

    ——–
    Uncaught TypeError: Cannot read property ‘length’ of undefined jqx-all.js:7
    b.extend._updateScrollbars jqx-all.js:7
    b.extend._arrange jqx-all.js:7
    b.extend.refresh jqx-all.js:7
    b.extend.propertyChangedHandler jqx-all.js:7
    a.jqx.setvalueraiseevent jqx-all.js:7
    (anonymous function) jqx-all.js:7
    x.extend.each jquery-1.10.2.js:665
    a.jqx.set jqx-all.js:7
    a.jqx.jqxWidgetProxy jqx-all.js:7
    (anonymous function) jqx-all.js:7
    x.extend.each jquery-1.10.2.js:657
    x.fn.x.each jquery-1.10.2.js:266
    a.fn.(anonymous function) jqx-all.js:7

    Uncaught TypeError: Cannot read property ‘length’ of undefined jqx-all.js:7
    b.extend._updateScrollbars jqx-all.js:7
    b.extend._arrange jqx-all.js:7
    b.extend.refresh jqx-all.js:7
    (anonymous function) jqx-all.js:7

    TreeGrid set 'source' problem #57482

    Peter Stoev
    Keymaster

    Hi seonghye kim,

    OK, if you experience such issue, then please provide an example which demonstrates it with this version – 3.4.

    With my test using the current version, I can’t reproduce such thing.

    Example:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdatatable.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxtreegrid.js"></script>
        <script type="text/javascript" src="../../scripts/demos.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {          
                // prepare the data
                var url = "../sampledata/employees.xml";
    
                var source =
                {
                    dataType: "xml",
                    dataFields: [
                        { name: 'EmployeeID', type: 'number' },
                        { name: 'ReportsTo', type: 'number' },
                        { name: 'FirstName', type: 'string' },
                        { name: 'LastName', type: 'string' },
                        { name: 'City', type: 'string' },
                        { name: 'Address', type: 'string' },
                        { name: 'Title', type: 'string' },
                        { name: 'HireDate', type: 'date' },
                        { name: 'BirthDate', type: 'date' }
                    ],
                    hierarchy:
                    {
                        keyDataField: { name: 'EmployeeID' },
                        parentDataField: { name: 'ReportsTo' }
                    },
                    id: 'EmployeeID',
                    root: 'Employees',
                    record: 'Employee',
                    url: url
                };
    
                var dataAdapter = new $.jqx.dataAdapter(source);
                // create Tree Grid
                $("#treeGrid").jqxTreeGrid(
                {
                    width: 850,
                    source: dataAdapter,
                    pageable: true,
                    columnsResize: true,
                    ready: function()
                    {
                        // expand row with 'EmployeeKey = 2'
                        $("#treeGrid").jqxTreeGrid('expandRow', 2);
                    },
                    columns: [
                      { text: 'FirstName', dataField: 'FirstName', minWidth: 100, width: 200 },
                      { text: 'LastName', dataField: 'LastName', width: 200 },
                      { text: 'Title', dataField: 'Title', width: 300 },
                      { text: 'Address', dataField: 'Address', width: 200 },
                      { text: 'City', dataField: 'City', width: 150 },
                      { text: 'Birth Date', dataField: 'BirthDate', cellsFormat: 'd', width: 120 },
                      { text: 'Hire Date', dataField: 'HireDate', cellsFormat: 'd', width: 120 }
                    ]
                });
                $("#rebind").click(function () {
                    var dataAdapter = new $.jqx.dataAdapter(source);
                    $("#treeGrid").jqxTreeGrid({ source: dataAdapter });
                });
            });
        </script>
    </head>
    <body class='default'>
        <div id="treeGrid">
        </div>
        <button id="rebind">Rebind</button>
    </body>
    </html>
    

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    TreeGrid set 'source' problem #57493

    seonghye kim
    Participant

    I found the exceptions are shown in jqxTreeGrid. jqxGrid is normal, when I use same data and data adapter.
    Also it was weired because the problem can’t reproduce in JSFiddle…

    So I changed the new version of jquery and jqx-all.js.
    And then, the exceptions are not shown anymore.

    jquery version 1.10.2 -> 1.11.1.
    jqwidgets version 3.2.2. -> 3.4.0.

    Anyway, thank you for your reply 🙂

    TreeGrid set 'source' problem #71950

    DjekkGabber
    Participant

    I have the problem “Cannot set property ‘treeGrid’ of null”. How I fix this problem?

    TreeGrid set 'source' problem #71952

    Peter Stoev
    Keymaster

    Hi DjekkGabber,

    We don’t understand what’s the issue from the short description. Prepare and share https://www.jseditor.io/ example.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.