jQWidgets Forums

jQuery UI Widgets Forums Grid Grid not loading json data

This topic contains 2 replies, has 2 voices, and was last updated by  tcorrigan5 9 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Grid not loading json data #83662

    tcorrigan5
    Participant

    The following code is from ASP .NET project. While the code in the scripts section is executing, the jqDataAdapter never even attempts to load the data

    
    @model Attendance.Models.BusModel
    @{
       Layout = "~/Views/Shared/_Layout.cshtml";
    }
    @section scripts {
       <script type="text/javascript">
          $(document).ready(function () {
             var source = {
                datatype: "json",
                dataFields: [
                   { name: 'selector', type: 'boolean' },
                   { name: 'regid', type: 'string' },
                   { name: 'name', type: 'string' },
                   { name: 'busepipen', type: 'string' },
                   { name: 'seatbelt', type: 'string' },
                   { name: 'note', type: 'string' }
                ],
                id: 'regid',
                url: 'Home/GetNotes'
             };
    
             source.url = 'Home/GetNotes/' + $("#bus").val();
    
             var dataAdapter = new $.jqx.dataAdapter(source, { autoBind: true });
    
             $("#jqxgrid").jqxGrid(
                {
                   width: 850,
                   height: 350,
                   source: dataAdapter,
                   columns: [
                      { text: 'Absent?', columntype: 'bool', datafield: 'selector', width: 60, editable: true },
                      { text: 'Reg #', datafield: 'regid', width: 60, editable: false },
                      { text: 'Name', datafield: 'name', width: 300, editable: false },
                      { text: 'Epi Pen', datafield: 'busepipen', width: 180, editable: false },
                      { text: 'Seat Belt', datafield: 'seatbelt', width: 120, editable: false },
                      { text: 'Notes', datafield: 'note', editable: false }
                   ]
                });
          });
       </script>
    }
    
    <div>
       <h1>@ViewBag.Message</h1>
       @Html.HiddenFor(x => x.bus)
       <br />
       <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
          <div id="jqxgrid"></div>
       </div>
    </div>
    

    Please advise as to how to fix this problem

    Grid not loading json data #83711

    Hristo
    Participant

    Hello tcorrigan5,

    Looks like url is not correct. You could use formatData member from DataAdapter there could override the data sent to the server.
    Do you have some error messages in the console? Is it possible you do not receive data?

    Please, take a look our ASP.NET section in ‘Demo’ – like this demo.
    And our ‘Documentation’ we have section – “ASP.NET Integration” this could be helpful.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Grid not loading json data #83714

    tcorrigan5
    Participant

    You are misunderstanding the question. It’s not that I’m not getting anything back from the server, it’s that the GET request to the server is never sent, which I can tell by looking at the network traffic in the debug mode of my browser. However I serendipitously solved the problem myself. I replaced all the script requests for the individual jqx javascript files (jqxcore, jqxdata, jqxgrid, etc.) as shown in all the examples with a single request for jqx-all.js. Then everything worked. It appears that jqx-all.js contains more than just the individual .js files listed in the example code.

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

You must be logged in to reply to this topic.