jQuery UI Widgets Forums Grid jqxGrid binding error

This topic contains 5 replies, has 2 voices, and was last updated by  Dimitar 10 years, 6 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • jqxGrid binding error #26775

    Yuri Antipin
    Participant

    Hi!

    I found error in binding localdata in jqxGrid control.
    Try click on any cell in my example with turned on debugger console. You’ll get an error:

    * TypeError: this.hittestinfo[k] is undefined //Firebug
    * Uncaught TypeError: Cannot convert null to object //Google Chrome debugger

    My example:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <title>jxgGrid dataBind error</title>
    <link rel="stylesheet" href="styles/jqx.base.css"/>
    <script type="text/javascript" src="scripts/jquery-1.10.2.min.js"> </script>
    <script type="text/javascript" src="scripts/jqx-all.js"> </script>
    <script type="text/javascript">
    $(document).ready(function() {
    var localdata = [];
    for (var i = 0; i < 10; i++) {
    localdata.push({
    id: i,
    column1: i.toString()
    });
    }
    var datafields = [{ name: 'id' }, { name: 'column1' }],
    columns = [{
    text: 'Column 1',
    datafield: 'column1'
    }];
    var source =
    {
    datafields: datafields,
    id: 'id',
    datatype: 'array',
    localdata: localdata
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    var gridSettings = {
    source: dataAdapter,
    columns: columns,
    height: '100%'
    };
    $('#grid').jqxGrid(gridSettings);
    $('#grid').css('border', 0);
    $('#grid').on('cellclick', function(event) {
    if (event.args.rightclick) return;
    var rowindex = event.args.rowindex;
    localdata.splice(rowindex, 10);
    dataAdapter.dataBind();
    });
    });
    </script>
    <style type="text/css">
    html, body { height: 100%; }
    body { margin: 0; }
    </style>
    </head>
    <body>
    <div id="grid" />
    </body>
    </html>
    jqxGrid binding error #26777

    Dimitar
    Participant

    Hello Yuri Antipin,

    We will investigate the reported issue. You may, however, use the deleterow method to delete a single or multiple rows.

    Best Regards,
    Dimitar

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

    jqxGrid binding error #26856

    Yuri Antipin
    Participant

    Hi Dimitar!

    If I use the deleterow method there is a similar error.

    Example with deleterow method:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <title>jxgGrid dataBind error</title>
    <link rel="stylesheet" href="styles/jqx.base.css"/>
    <script type="text/javascript" src="scripts/jquery-1.10.2.min.js"> </script>
    <script type="text/javascript" src="scripts/jqx-all.js"> </script>
    <script type="text/javascript">
    $(document).ready(function() {
    var localdata = [],
    i;
    for (i = 0; i < 10; i++) {
    localdata.push({
    id: i,
    column1: i.toString()
    });
    }
    var datafields = [{ name: 'id' }, { name: 'column1' }],
    columns = [{
    text: 'Column 1',
    datafield: 'column1'
    }];
    var source =
    {
    datafields: datafields,
    id: 'id',
    datatype: 'array',
    localdata: localdata
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    var gridSettings = {
    source: dataAdapter,
    columns: columns,
    height: '100%'
    };
    $('#grid').jqxGrid(gridSettings);
    $('#grid').css('border', 0);
    $('#grid').on('cellclick', function(event) {
    if (event.args.rightclick) return;
    var rowindex = event.args.rowindex;
    var rowid = parseInt($('#grid').jqxGrid('getrowid', rowindex));
    var rowIDs = [];
    for (i = 0; i < 10; i++) {
    rowIDs.push(rowid + i);
    }
    $('#grid').jqxGrid('deleterow', rowIDs);
    });
    });
    </script>
    <style type="text/css">
    html, body { height: 100%; }
    body { margin: 0; }
    </style>
    </head>
    <body>
    <div id="grid" />
    </body>
    </html>
    jqxGrid binding error #26863

    Dimitar
    Participant

    Hi Yuri Antipin,

    The issue comes from the fact that you try to delete rows that do not exist. E.g., if you click the fourth row (with index 3), you try to delete it and the next 9 rows with the following code:

    for (i = 0; i < 10; i++) {
    rowIDs.push(rowid + i);
    }
    $('#grid').jqxGrid('deleterow', rowIDs);

    However, there are only 6 more rows.

    Best Regards,
    Dimitar

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

    jqxGrid binding error #26871

    Yuri Antipin
    Participant

    Hi Dimitar!

    I know that in second example I’m trying to remove more rows than exist. I just gave an example of a script with deleterow method with which can be obtained similar error.
    In any case, the script must not fail even if source doesn’t contains row.

    jqxGrid binding error #26878

    Dimitar
    Participant

    Hi Yuri Antipin,

    We will investigate whether this is an actual jqxGrid issue. Thank you for your feedback.

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.