Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JQxTreeGrid已正确呈现,但未从json源加载数据_Javascript_Jquery_Json_Jqxgrid - Fatal编程技术网

Javascript JQxTreeGrid已正确呈现,但未从json源加载数据

Javascript JQxTreeGrid已正确呈现,但未从json源加载数据,javascript,jquery,json,jqxgrid,Javascript,Jquery,Json,Jqxgrid,请帮我解决这个问题。因此,我有以下代码将Json数据加载到Jquery网格中。。。。jqxTreegrid。到目前为止,网格显示了,但数据没有显示。此外,调试器不会向我显示任何类型的错误。因此,我将感谢任何帮助来解决这个问题 $(document).ready(function () { // prepare the data var source = { dataType: "json", dataFields: [

请帮我解决这个问题。因此,我有以下代码将Json数据加载到Jquery网格中。。。。jqxTreegrid。到目前为止,网格显示了,但数据没有显示。此外,调试器不会向我显示任何类型的错误。因此,我将感谢任何帮助来解决这个问题

$(document).ready(function () {
    // prepare the data
    var source =
    {
        dataType: "json",
        dataFields: [
            { name: 'sid', type: 'string' },
            { name: 'id', type: 'string' },
            { name: 'position', type: 'string' },
            { name: 'created_at', type: 'string' },
            { name: 'created_meta', type: 'number' },
            { name: 'updated_at', type: 'string' }, 
            { name: 'updated_meta', type: 'string' },
            { name: 'meta_data', type: 'string' }, 
            { name: 'community_area_number', type: 'number' },
            { name: 'community_area_name', type: 'string' }


        ],
        hierarchy:
        { 
           root: 'sid'

        },
          id: 'sid',
        //url: 'http://www.filedropper.com/employeesadv'
        //url: 'gdiChicago/employeesadv.csv'
        url: 'data.cityofchicago.org_Births-to-mothers-aged-15_19_kva-bt6k.json'
    }; 
    var dataAdapter = new $.jqx.dataAdapter(source);

    $("#content").on('rowselect', function(event){
            // event arguments
        var args = event.args;
        // row data
        var rowData = args.row;
        // row key
        var rowKey = args.key;
        console.log('RowSelect selected');
        event.stopPropagation();
        });

     $("#content").on('bindingComplete', function(event)
        {
            $("#content").jqxTreeGrid('hideColumn', 'name');
            console.log('Tree successfully loaded');
        });

    $("#content").on('beforeLoadComplete', function (records) {
        var data = new Array();
        // update the loaded records. Dynamically add EmployeeName and EmployeeID fields. 
        for (var i = 0; i < records.length; i++) {
            var employee = records[i];
            console.log(employee);
        } 
    });

    // create Tree Grid
    $("#content").jqxTreeGrid(
    {
        width: 1000,
        source: dataAdapter, 
        pageable: true,
        columnsResize: true,
        ready: function()
        {
            // expand row with 'EmployeeKey = 32'
            $("#content").jqxTreeGrid('expandRow', 32);
        },
        columns: [ 
           { text: 'sid', dataField:  'sid', minWidth: 100, width: 300 },
           { text: 'id', dataField:'id', minWidth: 100, width: 300 },
           { text: 'position', dataField:'position', minWidth: 100, width: 300 },
           { text: 'created at', dataField:  'created_at' , minWidth: 100, width: 300 },
           { text: 'created meta', dataField:  'created_meta' , minWidth: 100, width: 300 },
           { text: 'updated at', dataField:  'updated_at', minWidth: 100, width: 300 },
           { text: 'updated meta', dataField:'updated_meta', minWidth: 100, width: 300 },
           { text: 'meta', dataField:'meta', minWidth: 100, width: 300 },
           { text: 'Community Area Number', dataField:  'community_area_number' , minWidth: 100, width: 300 }, 
           { text: 'community area name', dataField:  'community_area_name', minWidth: 100, width: 300 }           

        ]
    });

});
$(文档).ready(函数(){
//准备数据
变量源=
{
数据类型:“json”,
数据字段:[
{name:'sid',type:'string'},
{name:'id',type:'string'},
{name:'position',type:'string'},
{name:'created_at',键入:'string'},
{name:'created_meta',键入:'number'},
{name:'updated_at',键入:'string'},
{name:'updated_meta',键入:'string'},
{name:'meta_data',键入:'string'},
{name:'community\u area\u number',键入:'number'},
{name:'community\u area\u name',键入:'string'}
],
等级制度:
{ 
根:'sid'
},
id:'sid',
//网址:'http://www.filedropper.com/employeesadv'
//url:'gdichacago/employeesadv.csv'
url:'data.cityofchicago.org_birts-to-mothers-age-15_19_kva-bt6k.json'
}; 
var dataAdapter=new$.jqx.dataAdapter(源);
$(“#内容”)。在('rowselect',函数(事件){
//事件参数
var args=event.args;
//行数据
var rowData=args.row;
//行键
var rowKey=args.key;
console.log('RowSelect selected');
event.stopPropagation();
});
$(“#内容”)。关于('bindingComplete',函数(事件)
{
$(“#content”).jqxTreeGrid('hideColumn','name');
log('Tree successfully loaded');
});
$(“#内容”)。在('beforeLoadComplete',函数(记录)上{
var data=新数组();
//更新加载的记录。动态添加EmployeeName和EmployeeID字段。
对于(var i=0;i
我尝试加载的json数据源可以通过此链接获得,而不是使用

hierarchy:
{ 
  root: 'sid'    
},
试用

hierarchy:
     { 
        keyDataField: { name: 'sid' }        
     },