第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

默認(rèn)情況下如何將空的最后一行添加到 Kendo Ui 網(wǎng)格

默認(rèn)情況下如何將空的最后一行添加到 Kendo Ui 網(wǎng)格

MMMHUHU 2023-09-28 17:10:16
默認(rèn)情況下,我需要在編輯模式下將空的最后一行添加到 Kendo UI 網(wǎng)格。我正在從 api 獲取數(shù)據(jù),如果我嘗試最后添加空行,它首先被調(diào)用,然后 api 被調(diào)用。我該怎么做。我不想設(shè)置超時。我嘗試在數(shù)據(jù)源中添加空記錄,但為此我需要做很多事情var dataSource = new kendo.data.DataSource({                type: "odata",                serverPaging: false,                serverSorting: false,                serverFiltering: false,                //pageSize: 20,                schema: {                    data: function (data) {                        var resultData = [];                        if (data.value != null && data.value[0].Payload != null && data.value[0].Payload != "[]")                            resultData = JSON.parse(data.value[0].Payload);                        return resultData;                    },                    total: function (data) {                        var length = 0;                        if (data.value != null)                            length = data.value[0].PayloadCount;                       return length;                    },                    model: {                        id: that.gridProperties.PrimaryKeyName,                        fields: that.gridProperties.Schema                    }                },                change: that.onGridDataChanged,                transport: {                    read: {                        url: that.gridProperties.DataSourceURL,                        contentType: "application/json; charset=utf-8",                        type: "GET",                        dataType: "json"                    }                }            });         
查看完整描述

2 回答

?
慕標(biāo)5832272

TA貢獻(xiàn)1966條經(jīng)驗 獲得超4個贊

您可以使用 requestEnd 設(shè)置數(shù)據(jù)源,以在網(wǎng)格行數(shù)據(jù)的末尾添加一個空行。


        dataSource: {

            type: "GET",

            dataType: "json",

            transport: {

                read: "url"

            },

            requestEnd: function(e) {

              e.response.d.results.push({Field: ''});

            }

        }

此外,這會導(dǎo)致空單元格的行為不同并且高度較小,您可以通過添加以下 css 來解決這個問題。


        .k-grid tr{height: 33px;}


查看完整回答
反對 回復(fù) 2023-09-28
?
臨摹微笑

TA貢獻(xiàn)1982條經(jīng)驗 獲得超2個贊

嘗試使用 dataSource 的requestEnd事件。您可以在數(shù)據(jù)列表的末尾添加一個空行:

<!DOCTYPE html>

<html>

<head>

? ? <base >

? ? <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>

? ? <title></title>

? ? <link rel="stylesheet" />


? ? <script src="https://kendo.cdn.telerik.com/2020.3.1118/js/jquery.min.js"></script>

? ??

? ??

? ? <script src="https://kendo.cdn.telerik.com/2020.3.1118/js/kendo.all.min.js"></script>

? ??

? ??


</head>

<body>

? ? <div id="example">

? ? <div id="grid"></div>

? ? <script>

? ? ? ? $(document).ready(function() {

? ? ? ? ? ? $("#grid").kendoGrid({

? ? ? ? ? ? ? ? dataSource: {

? ? ? ? ? ? ? ? ? ? type: "odata",

? ? ? ? ? ? ? ? ? ? transport: {

? ? ? ? ? ? ? ? ? ? ? ? read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Categories"

? ? ? ? ? ? ? ? ? ? },

? ? ? ? ? ? ? ? ? ? requestEnd: function(e) {

? ? ? ? ? ? ? ? ? ? ? e.response.d.results.push({CategoryName: ''});

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? },

? ? ? ? ? ? ? ? height: 550,

? ? ? ? ? ? ? ? filterable: true,

? ? ? ? ? ? ? ? sortable: true,

? ? ? ? ? ? ? ? pageable: true,

? ? ? ? ? ? ? ? columns: [

? ? ? ? ? ? ? ? ? ? "CategoryName"

? ? ? ? ? ? ? ? ]

? ? ? ? ? ? });

? ? ? ? });

? ? </script>

</div>



? ??


</body>

</html>



查看完整回答
反對 回復(fù) 2023-09-28
  • 2 回答
  • 0 關(guān)注
  • 147 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號