EasyUI Forum
September 18, 2025, 11:59:13 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED] Can't figure out why not loading  (Read 15449 times)
MB34
Newbie
*
Posts: 20


View Profile
« on: June 24, 2015, 01:56:49 PM »

I am having issues loading a jQuery EasyUI Datagrid at this URL:
http://www.scic.com/files/event_attendance

Enter the event code 20150731TXAO and click the Load Attendees button.

This is the raised Exception and Call Stack:
Code:
Uncaught TypeError: Cannot read property 'length' of undefined

_745.renderTable @ jquery.easyui.min.js:10102
_745.render @ jquery.easyui.min.js:10079
_612 @ jquery.easyui.min.js:9032
(anonymous function) @ jquery.easyui.min.js:9682
st.extend.each @ jquery.js:642
st.fn.st.each @ jquery.js:263
$.fn.datagrid @ jquery.easyui.min.js:9657
(anonymous function) @ (index):169
st.Callbacks.f @ jquery.js:1026
st.Callbacks.p.fireWith @ jquery.js:1138
r @ jquery.js:8021
st.ajaxTransport.send.r @ jquery.js:8558
    XMLHttpRequest.send (async)
st.ajaxTransport.send @ jquery.js:8475
st.extend.ajax @ jquery.js:7930
st.each.st.(anonymous function) @ jquery.js:7569
loadAttendees @ (index):163
(anonymous function) @ (index):143
st.event.dispatch @ jquery.js:3045
st.event.add.y.handle @ jquery.js:2721

The data is loaded in the loadAttendees function in a jQuery $.get. It is stored in the variable window.data and then the datagrid is initialized.
Code:
function loadAttendees(EventCode) {
    $.get('getEventAttendees.php?event_code='+EventCode, function(data) {
        window.data = data;
        $("#upload").hide();
        $("#grid_area").show();
        
        $('#dg').datagrid({
            title:'Event Attendees',
            width:'100%',
            height:600,
            remoteSort:false,
            nowrap:false,
            fitColumns:true,
            striped: true,
            border:true,
            collapsible:true,
            data: window.data,
            toolbar:"#tb",
            columns:[[
                {field:'event_code',   visible:false},
                {field:'participantid',title:'Alliance#',      width:60,  sortable:true},
                {field:'full_name',    title:'Full Name',      width:100, editor:'text', sortable:true},
                {field:'lic_num',      title:'License Number', width:60,  editor:'text'},
                {field:'lic_state',    title:'License State',  width:40, editor:'text'},
                {field:'want_ce',      title:'CE',             width:10,  editor:'checkbox'},
                {field:'attended',     title:'AT',             width:10,  editor:'checkbox'}
            ]]
        });
    });
};

I can't understand why it doesn't load any data.
This is the data it is trying to load:
Code:
"{"total":2,"rows":[{"event_code":"20150731TXAO","participantid":1158341,"full_name":"Eddie Shipman","lic_num":110987,"lic_state":"TX"},{"event_code":"20150731TXAO","participantid":1079745,"full_name":"Dustin Payne","lic_num":231896,"lic_state":"TX"}]}"
« Last Edit: July 10, 2015, 10:39:19 AM by MB34 » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: June 24, 2015, 06:08:56 PM »

You load a wrong data type, please use the code below instead:
Code:
$('#dg').datagrid({
  data: JOSN.parse(window.data)
});
Logged
MB34
Newbie
*
Posts: 20


View Profile
« Reply #2 on: July 03, 2015, 02:37:20 PM »

Thanks. That did it...
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!