jQWidgets Forums

jQuery UI Widgets Forums Grid Grid doesn't show anything

This topic contains 4 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Grid doesn't show anything #26212

    gargoyle
    Member

    I’m trying to load my grid based on data in my database. I’ve create a php method that returns JSON data as an array of dictionaries, with the keys being the names shown in the datafields below. When I load my page I get a blank screen. I also never get any of the alerts that the dataAdapter should be displaying. I’ve verified there are no errors/warnings in the Apache error_log file.

    Have I skipped a step?

    This is how I tried to setup the grid:

    $(document).ready(function () {
    var source = {
    datatype: “json”,
    cache: false,
    datafields: [
    { name: ‘ident’, type: ‘int’ },
    { name: ‘mon’, type: ‘string’ },
    { name: ‘name’, type: ‘string’ },
    { name: ‘available’, type: ‘float’ },
    { name: ‘borrowed’, type: ‘float’ },
    { name: ‘carryover’, type: ‘float’ }
    ],
    id: ‘ident’,
    url: ‘ajax/allUsage.php’
    };

    var dataAdapter = new $.jqx.dataAdapter(source, {
    loadComplete: function (data) { alert(“Load complete”); },
    downloadComplete: function (data) { alert(“Download complete”); },
    loadError: function (xhr, status, error) { alert(error); }
    });

    $(“#jqxgrid”).jqxGrid({
    source: dataAdapter,
    theme: ‘classic’,
    columns: [
    { text: ‘Month’, datafield: ‘mon’, width: 100 },
    { text: ‘Client’, datafield: ‘name’, width: 100 },
    { text: ‘Available’, datafield: ‘available’, cellsalign: ‘right’, width: 100 },
    { text: ‘Borrowed’, datafield: ‘borrowed’, cellsalign: ‘right’, width: 100 },
    { text: ‘Rollover’, datafield: ‘carryover’, cellsalign: ‘right’, width: 100 }
    ]
    });
    });

    Grid doesn't show anything #26213

    gargoyle
    Member

    Here’s the complete page source: Full Page Source

    Grid doesn't show anything #26214

    Peter Stoev
    Keymaster

    Hi gargoyle,

    For getting started with jqxGrid, please look at this help topic: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-getting-started.htm. I also suggest you to check whether the path to the JavaScript, CSS and Data files is correct. If they are, then check whether your PHP page returns JSON data.

    Best Regards,
    Peter Stoev

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

    Grid doesn't show anything #26218

    gargoyle
    Member

    They’re all correct. Like I said, no errors in the apache logs. If I run the PHP page manually I get back the expected JSON data.

    Grid doesn't show anything #26226

    Peter Stoev
    Keymaster

    Hi gargoyle,

    Unfortunately, I do not know what could be the issue on your side. It could be a wrong path to the data file or something else. If you would like, please send us a sample JSON which you try to load in the Grid and we will test whether the issue is in the Grid or not.

    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.