Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.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 剑道ui网格加载指示器未显示_Javascript_Jquery_Kendo Ui_Telerik_Kendo Grid - Fatal编程技术网

Javascript 剑道ui网格加载指示器未显示

Javascript 剑道ui网格加载指示器未显示,javascript,jquery,kendo-ui,telerik,kendo-grid,Javascript,Jquery,Kendo Ui,Telerik,Kendo Grid,我在我的html页面中使用了剑道网格,每件事情都运行得很好,但当页面加载时我面临一个问题,我发送请求获取数据需要1到2秒,同时网格应该显示加载指示器,正如我们在中看到的。这就是我正在做的 $.ajax({ type: "GET", contentType: "application/json; charset=utf-8", url: api/getdata, dataType: 'json',

我在我的html页面中使用了剑道网格,每件事情都运行得很好,但当页面加载时我面临一个问题,我发送请求获取数据需要1到2秒,同时网格应该显示加载指示器,正如我们在中看到的。这就是我正在做的

 $.ajax({
            type: "GET",
            contentType: "application/json; charset=utf-8",
            url: api/getdata,
            dataType: 'json',
            cache: false,
            headers: { 'ccode': compCode },
            async: false,
            data: '?&tableName=' + table + '&userId=' + userId + '&fromDate=' + dateFrom + '&toDate=' + dateto + '&isSearchForClient=' + true,
            success: function (result) {
                var data = [];
                if (result) {
                    result = result.replace(/&/g, "'");
                    var jsonResult = JSON.parse(JSON.parse(result));
                    for (var i = 0; i < jsonResult.length; i++) {
                        data.push({ Log: jsonResult[i]["Log"], TransactionId: jsonResult[i]["TransactionId"] });
                    }
                    var grid = $("#logs").kendoGrid({
                        dataSource: {
                            data: data,
                            schema: {
                                model: {
                                    fields: {
                                        TransactionId: { type: "string" },
                                        Log: { type: "string" }
                                    }
                                }
                            },
                            pageSize: 10
                        },
                        height: 405,
                        scrollable: true,
                        detailInit: detailInit,
                        detailExpand: function (e) {
                            this.collapseRow(this.tbody.find(' > tr.k-master-row').not(e.masterRow));
                        },
                        pageable: {
                            input: true,
                            numeric: false
                        },
                        columns: [
                            { field: 'Log', title: "Audit Logs", encoded: true }]
                    });
                    //grid.dataSource.read();
                }
            }
        });

为什么要显示出来?据我所见,您正在使用ajax加载数据,加载完成时是创建网格时。是吗?是的@OnaBai你是对的……我应该删除这个问题还是需要回答这个问题呢?好的,答案是要么你从dataSource.transport.read内部执行ajax,要么你应该自己加载并在成功时删除它。你知道如何或者你需要我改变你的代码并告诉你怎么做吗?我知道怎么做,但只是问这个问题,因为你给我指出了问题,现在一切都好了。