jQWidgets Forums

jQuery UI Widgets Forums Grid simple json parse

Tagged: 

This topic contains 2 replies, has 1 voice, and was last updated by  shawn 9 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • simple json parse #79620

    shawn
    Participant

    I’m having trouble getting my json data to show in my grid.
    The grid will display the correct number of rows relative to the number of records in the json string.

    json looks like this:

    {  
       "aMatch":[  
          {  
             "uName":"aleffler",
             "rqDate":"12/21/2015 05:59:00 AM",
             "ipAddr":"xxx.xxx.xxx.xxx",
             "programName":"login"
          },
          {  
             "uName":"aleffler",
             "rqDate":"12/21/2015 05:59:01 AM",
             "ipAddr":"xxx.xxx.xxx.xxx",
             "programName":"loadUI"
          },
          {  
             "uName":"aleffler",
             "rqDate":"12/21/2015 05:59:44 AM",
             "ipAddr":"xxx.xxx.xxx.xxx",
             "programName":"login"
          }
      ]
    }
    

    I’m getting the grid data like this

                var source =
                {
                    datatype: "json",
                    datafields: [
                        { name: 'uName', type: 'string' },
                        { name: 'rqDate', type: 'string' },
                        { name: 'ipAddr', type: 'string' },
                        { name: 'programName', type: 'string' }                    
                    ],
                    record: "uName",
                    url: url
                };
    

    Why is there no data on my grid?
    thanks

    simple json parse #79621

    shawn
    Participant

    also, I am initializing like this:

    
                $("#jqxgrid").jqxGrid(
                {
                    width: 800,
                    source: dataAdapter,                
                    pageable: true,
                    autoheight: true,
                    sortable: true,
                    altrows: true,
                    enabletooltips: true,
                    editable: true,
                    selectionmode: 'multiplecellsadvanced',
                    columns: [
                      { text: 'User',datafield:'uName'},
                      { text: 'Request Date',datafield:'rqDate' },
                      { text: 'IP Address',datafield:'ipAddr'},
                      { text: 'Program Name',datafield:'programName'}                  
                    ]
                });
    simple json parse #79622

    shawn
    Participant

    well, I got it to work by preparing the data in this way

                var source =
                {
                    datatype: "json",
                    datafields: [
                        { name: 'uName', type: 'string' },
                        { name: 'rqDate', type: 'string' },
                        { name: 'ipAddr', type: 'string' },
                        { name: 'programName', type: 'string' }                    
                    ],
                    root: "aMatch",
                    url: url
                };
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.