jQWidgets Forums

jQuery UI Widgets Forums Grid Display "No Data" message?

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  realtek 11 years, 8 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Display "No Data" message? #30761

    realtek
    Participant

    Hi,

    How can I get the Grid to display a message saying “No Data” when the grid is empty?

    Just like the Demo? I can’t seem to see how its done?

    Thanks!

    Display "No Data" message? #30762

    Peter Stoev
    Keymaster

    Hi realtek,

    It is done automatically when you do not have data loaded into the Grid

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Display "No Data" message? #30927

    realtek
    Participant

    Thanks Peter,

    In my Grid it seems I get a blank ’empty’ row which is why i’m not getting the “No Data” message displayed.

    Here is my code:

    var source = {
    datatype: 'json',
    url: url,
    id: "SEQUENCE",
    root: 'rowsinfo',
    cache: false,
    columns:[],
    datafields:[],
    beforeprocessing: function (data) {
    var columnsdata = new Array();
    var datafieldsdata = new Array();
    for (k in data.columnsinfo){
    var col={};
    col.text = data.columnsinfo[k]["DISPLAYNAME"];
    col.datafield = data.columnsinfo[k]["DISPLAYNAME"];
    var datafields={};
    datafields.name = data.columnsinfo[k]["DISPLAYNAME"];
    columnsdata .push(col);
    datafieldsdata .push(datafields);
    source.columns = columnsdata;
    source.datafields = datafieldsdata;
    }
    $("#jqxgrid").jqxGrid({columns : source.columns});
    },
    data: {
    group: selectedGroup,
    staff: selectedStaff,
    MODULE: selectedModuleSEQ
    }
    };

    Any idea’s? I don’t think the JSON is returning an empty record as I disabled it temporarily.

    Display "No Data" message? #30934

    Peter Stoev
    Keymaster

    Hi realtek,

    The Grid’s logic about that is quite simple, If the dataAdapter’s records array is empty, then The Grid will display the message, otherwise it will display the data. Please, look on your side what JSON you return and try to load.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Display "No Data" message? #30947

    realtek
    Participant

    Hi Peter,

    This is what my JSON returns when no data should display:

    {“columnsinfo”:[{“FIELDNAME”:”Number”,”DISPLAYNAME”:”Number #”},{“FIELDNAME”:”Description”,”DISPLAYNAME”:”Description Text”},{“FIELDNAME”:”Display”,”DISPLAYNAME”:”Display ID”}]}

    So rowsinfo is not returned at all because there is no data?

    My “columnsinfo” is the columns being returned for the Grid which will exist.

    Thanks

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

You must be logged in to reply to this topic.