jQWidgets Forums

jQuery UI Widgets Forums Grid Display data in jqxGrid json object

This topic contains 0 replies, has 1 voice, and was last updated by  reggaeone13 11 years, 9 months ago.

Viewing 1 post (of 1 total)
  • Author
  • Display data in jqxGrid json object #29330

    reggaeone13
    Participant

    Hi guys,

    I am using ASP.NET C# and a WebMethod in code-behind to get the data (json object) from database.
    Everything appears to work (json object can be build, but has not a {“data”: at first, it has only the array with the records), but no data appears on the page. The resulting page shows a blank grid with 3 columns and 15 rows.
    Why the data is not being rendered to the grid?
    Is something I missing in my code?
    Should I insert the element {“data”: to json object?
    Please help!
    Here is a part of the relevant code:

    var sourceGrid = {
    datatype: “json”,
    cache: false,
    contentType: ‘application/json; charset=utf-8’,

    datafields: [
    { name: ‘Id’, type: ‘string’ },
    { name: ‘Date’, type: ‘date’ },
    { name: ‘Comment’, type: ‘string’ }
    ],
    async: false,

    url: ‘Default.aspx/GetData’,
    id: ‘Id’,

    }

    var dataAdapterGrid = new $.jqx.dataAdapter(sourceGrid,
    {
    contentType: ‘application/json; charset=utf-8’
    }

    $(“#jqxgrid”).jqxGrid({
    source: dataAdapterGrid,
    theme: theme,
    width: gridWidth,
    rowsheight: 30,
    autoheight: true,
    showstatusbar: true,
    editable: true,

    }

    If I put a record: ‘content’ in the sourceGrid object, then a message appears “No data to display”, otherwise 15 empty rows.
    Should I use a WebService ‘http://localhost:1216/Service.asmx/GetData’?
    Please, help!
    Thanks a lot!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.