Syncfusion ej2 Grid 不显示远程数据

问题描述

我正在尝试制作一个简单的 Web 应用程序来显示和管理用户列表。

代码如下:

        ej.base.enableRipple(window.ripple)

        const data = new ej.data.DataManager({
            url: "/users/list",adaptor: new ej.data.WebApiAdaptor(),crossDomain: true
        });

        app.users.grid = new ej.grids.Grid({
            dataSource: data,allowPaging: false,columns: [
                {field: 'id',headerText: 'User ID',width: 50,textAlign: 'Left'},{field: 'login',headerText: 'Login Name',width: 200},{field: 'full_name',headerText: 'Full name',width: 300,{field: 'is_blocked',headerText: 'Blocked?',width: 120,textAlign: 'Center'},{
                    headerText: 'Operations',width: 140,commands: [
                        {type: 'Edit',buttonoption: {iconCss: ' e-icons e-edit',cssClass: 'e-flat'}},{type: 'Delete',buttonoption: {iconCss: 'e-icons e-delete',cssClass: 'e-flat'}}
                    ]
                }
            ]
        });

        app.users.grid.appendTo('#Grid');

加载页面时,网格加载指示器显示在网格顶部,并且在浏览器开发人员工具中,我也可以看到对 /users/list 的正确请求,该请求返回以下结果:

[{"id":2,"login":"asapfly@gmail.com","full_name":"Andrey","created_at":"2021-02-19T15:44:38.000Z","is_global_admin":false,"is_blocked":false}]

但是,仍然在网格上显示一条消息“没有要显示的记录”,并且控制台中也没有错误

你能给我一些建议吗?

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)