jQuery UI Widgets Forums Grid grid loading delay

Tagged: ,

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

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • grid loading delay #16368

    The grid is taking ~ 700 ms – 800 ms to load.
    Any pointers to increase the performance?

    I ve attached the code, settings of grid and the time delay.

    alert(JSON.stringify(gridSettings));
    timeNote+=”initiate grid : “+new Date().getTime()+”\n”;
    $(‘#’+gridId).jqxGrid(gridSettings);
    timeNote+=”grid done : “+new Date().getTime()+”\n”;

    —————————————–

    timeNote :

    initiate grid : 1269990326500
    grid done : 1269990327325

    —————————————–

    gridSettings :

    {
    “width”: “100%”,
    “theme”: “BaseTheme”,
    “source”: {
    “_source”: {
    “datatype”: “json”,
    “localdata”: [
    {
    “Name”: “1”,
    “Value”: “$0.00”,
    “parent”: “0”
    },
    {
    “Name”: “2”,
    “Value”: “$0.00”,
    “parent”: “0”
    },
    {
    “Name”: “3”,
    “Value”: “$0.00”,
    “parent”: “0”
    },
    {
    “Name”: “4”,
    “Value”: “0.00 %”,
    “parent”: “0”
    },
    {
    “Name”: “5”,
    “Value”: “0.00 %”,
    “parent”: “0”
    },
    {
    “Name”: “6”,
    “Value”: “$0.00”,
    “parent”: “0”
    },
    {
    “Name”: “7”,
    “Value”: “$0.00”,
    “parent”: “1”
    },
    {
    “Name”: “8”,
    “Value”: “$0.00”,
    “parent”: “1”
    },
    {
    “Name”: “9”,
    “Value”: “$0.00”,
    “parent”: “1”
    },
    {
    “Name”: “10”,
    “Value”: “$0.00”,
    “parent”: “0”
    },
    {
    “Name”: “11”,
    “Value”: “$0.00”,
    “parent”: “1”
    },
    {
    “Name”: “12”,
    “Value”: “$0.00”,
    “parent”: “1”
    },
    {
    “Name”: “13”,
    “Value”: “$0.00”,
    “parent”: “1”
    },
    {
    “Name”: “14”,
    “Value”: “$0.00”,
    “parent”: “0”
    },
    {
    “Name”: “15”,
    “Value”: “0”,
    “parent”: “0”
    },
    {
    “Name”: “16”,
    “Value”: “0”,
    “parent”: “1”
    },
    {
    “Name”: “17”,
    “Value”: “0”,
    “parent”: “1”
    },
    {
    “Name”: “18”,
    “Value”: “$0.00”,
    “parent”: “0”
    },
    {
    “Name”: “19”,
    “Value”: “$0.00”,
    “parent”: “0”
    },
    {
    “Name”: “20”,
    “Value”: “$0.00”,
    “parent”: “0”
    },
    {
    “Name”: “21”,
    “Value”: “0.00 %”,
    “parent”: “0”
    },
    {
    “Name”: “22”,
    “Value”: “0.00 %”,
    “parent”: “0”
    },
    {
    “Name”: “23”,
    “Value”: “0”,
    “parent”: “0”
    },
    {
    “Name”: “24”,
    “Value”: “0”,
    “parent”: “1”
    },
    {
    “Name”: “25”,
    “Value”: “0”,
    “parent”: “1”
    }
    ]
    },
    “_options”: {},
    “records”: [],
    “_downloadComplete”: [],
    “_bindingUpdate”: []
    },
    “rowsheight”: 28,
    “enablehover”: false,
    “scrollbarsize”: 40,
    “pageable”: true,
    “pagershowrowscombo”: false,
    “pagerheight”: 60,
    “pagesize”: 16,
    “selectionmode”: “none”,
    “columnsheight”: 32,
    “showheader”: false,
    “columns”: [
    {
    “datafield”: “Name”,
    “width”: 686.4
    },
    {
    “datafield”: “Value”,
    “width”: 171.6
    }
    ]
    }

    ——————————————

    We have a cell rendering function applied for the column( with “data field” : “Name”)
    cell renderer :

    function CellsRenderer(row, column, value)
    {
    return ‘

    ‘ + value + ‘

    ‘;
    }

    grid loading delay #16372

    Peter Stoev
    Keymaster

    Hi harikalaprasath,

    1. The provided initialization is not correct. You can learn how to initialize the Grid from this help topic: jquery-grid-getting-started.htm.

    2. The loading time depends on many factors and mostly the browser that you use and the jQWidgets version that you use.

    For example, the following code takes ~150ms with IE10 on my machine. The jQWidgets version is 2.7

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title id='Description'>This example shows how to create a Grid from Array data.</title>
    <link rel="stylesheet" href="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="http://www.jqwidgets.com/jquery-widgets-demo/scripts/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxmenu.js"></script>
    <script type="text/javascript" src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxgrid.selection.js"></script>
    <script type="text/javascript" src="http://www.jqwidgets.com/jquery-widgets-demo/jqwidgets/jqxgrid.columnsresize.js"></script>
    <script type="text/javascript" src="http://www.jqwidgets.com/jquery-widgets-demo/scripts/gettheme.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    var theme = getDemoTheme();
    // prepare the data
    var data = new Array();
    var firstNames =
    [
    "Andrew", "Nancy", "Shelley", "Regina", "Yoshi", "Antoni", "Mayumi", "Ian", "Peter", "Lars", "Petra", "Martin", "Sven", "Elio", "Beate", "Cheryl", "Michael", "Guylene"
    ];
    var lastNames =
    [
    "Fuller", "Davolio", "Burke", "Murphy", "Nagase", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler", "Bein", "Petersen", "Rossi", "Vileid", "Saylor", "Bjorn", "Nodier"
    ];
    var productNames =
    [
    "Black Tea", "Green Tea", "Caffe Espresso", "Doubleshot Espresso", "Caffe Latte", "White Chocolate Mocha", "Cramel Latte", "Caffe Americano", "Cappuccino", "Espresso Truffle", "Espresso con Panna", "Peppermint Mocha Twist"
    ];
    var priceValues =
    [
    "2.25", "1.5", "3.0", "3.3", "4.5", "3.6", "3.8", "2.5", "5.0", "1.75", "3.25", "4.0"
    ];
    for (var i = 0; i < 200; i++) {
    var row = {};
    var productindex = Math.floor(Math.random() * productNames.length);
    var price = parseFloat(priceValues[productindex]);
    var quantity = 1 + Math.round(Math.random() * 10);
    row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)];
    row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)];
    row["productname"] = productNames[productindex];
    row["price"] = price;
    row["quantity"] = quantity;
    row["total"] = price * quantity;
    data[i] = row;
    }
    var source =
    {
    localdata: data,
    datatype: "array",
    datafields:
    [
    { name: 'firstname', type: 'string' },
    { name: 'lastname', type: 'string' },
    { name: 'productname', type: 'string' },
    { name: 'quantity', type: 'number' },
    { name: 'price', type: 'number' },
    { name: 'total', type: 'number' }
    ]
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    var time1 = new Date().getTime();
    $("#jqxgrid").jqxGrid(
    {
    width: '100%',
    source: dataAdapter,
    theme: theme,
    columnsresize: true,
    columns: [
    { text: 'Name', dataField: 'firstname', width: 100 },
    { text: 'Last Name', dataField: 'lastname', width: 100 },
    { text: 'Product', editable: false, dataField: 'productname', width: 180 },
    { text: 'Quantity', dataField: 'quantity', width: 80, cellsalign: 'right' },
    { text: 'Unit Price', dataField: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' },
    { text: 'Total', dataField: 'total', cellsalign: 'right', minwidth: 100, cellsformat: 'c2' }
    ]
    });
    var time2 = new Date().getTime();
    alert(time2 - time1);
    });
    </script>
    </head>
    <body class='default'>
    <div id='jqxWidget'>
    <div id="jqxgrid">
    </div>
    </div>
    </body>
    </html>

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    grid loading delay #16388

    i just provided the settings object for your information.
    i haven’t created an object with such specifications manually.

    I have a local json object. To provide it to the grid i am using the data adapter as specified in your examples.

    source=
    {
    datatype : ‘json’,
    localdata : data
    };
    dataAdapter = new $.jqx.dataAdapter(source);

    the only change is, I have my settings for the grid not provided as such inside “$(“#jqxgrid”).jqxGrid();” instead ive put it into an object and then called the jqxgrid with that object.

    $(“#jqxgrid”).jqxGrid(gridSettings);
    gridSettings :

    {
    width: “100%”,
    theme: “BaseTheme”,
    source: dataAdapter,
    rowsheight: 28,
    enablehover: false,
    scrollbarsize: 40,
    pageable: true,
    pagershowrowscombo: false,
    pagerheight: 60,
    pagesize: 16,
    selectionmode: “none”,
    columnsheight: 32,
    columns: [
    { text: ‘Name’, dataField: ‘Name’, cellsrenderer: CellsRenderer, width: 686.4 },
    { text: ‘Value’, dataField: ‘Value’, width: 171.6 }
    ]
    }

    So, with this being the only difference, initialization would not be a problem… ?
    P.S.: I am using jqWidgets2.4.2.

    grid loading delay #16390

    the browser being used is : webkit 1.10.2
    Platform : Linux

    grid loading delay #16428

    Peter Stoev
    Keymaster

    Hi harikalaprasath,

    If you want the Grid to run much faster, please upgrade to jQWidgets 2.7.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    grid loading delay #16539

    It worked.
    thanks… 🙂
    Less than half time…

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

You must be logged in to reply to this topic.