中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

bootstrapTable sidePagination server出現No matching

發布時間:2020-07-26 14:20:04 來源:網絡 閱讀:710 作者:ninnycalf 欄目:web開發

bootstrapTable sidePagination server pagination true 出現No matching records found
對此糾結了一上午,首先百度、google,其實作者已經給出例子了,不仔細查看api和wiki怪不得別人哇!!!
作者例子:
http://issues.wenzhixin.net.cn/bootstrap-table/#options/server-side-pagination.html
從里面可以看到數據格式應該是:

{
  "total": 800,
  "rows": [
    {
      "id": 0,
      "name": "Item 0",
      "price": "$0"
    },
    {
      "id": 1,
      "name": "Item 1",
      "price": "$1"
    },
    {
      "id": 2,
      "name": "Item 2",
      "price": "$2"
    },
    {
      "id": 3,
      "name": "Item 3",
      "price": "$3"
    },
    {
      "id": 4,
      "name": "Item 4",
      "price": "$4"
    },
    {
      "id": 5,
      "name": "Item 5",
      "price": "$5"
    },
    {
      "id": 6,
      "name": "Item 6",
      "price": "$6"
    },
    {
      "id": 7,
      "name": "Item 7",
      "price": "$7"
    },
    {
      "id": 8,
      "name": "Item 8",
      "price": "$8"
    },
    {
      "id": 9,
      "name": "Item 9",
      "price": "$9"
    }
  ]
}

這種json格式,就可以了,前端就會有數據了!!!
client的不需要前面的total和rows

[
    {
        "id": 0,
        "name": "Item 0",
        "price": "$0",
        "amount": 3
    },
    {
        "id": 1,
        "name": "Item 1",
        "price": "$1",
        "amount": 4
    },
    {
        "id": 2,
        "name": "Item 2",
        "price": "$2",
        "amount": 8
    },
    {
        "id": 3,
        "name": "Item 3",
        "price": "$3",
        "amount": 2
    },
    {
        "id": 4,
        "name": "Item 4",
        "price": "$4",
        "amount": 90
    },
    {
        "id": 5,
        "name": "Item 5",
        "price": "$5",
        "amount": 2
    },
    {
        "id": 6,
        "name": "Item 6",
        "price": "$6",
        "amount": 3
    },
    {
        "id": 7,
        "name": "Item 7",
        "price": "$7",
        "amount": 7
    },
    {
        "id": 8,
        "name": "Item 8",
        "price": "$8",
        "amount": 39
    },
    {
        "id": 9,
        "name": "Item 9",
        "price": "$9",
        "amount": 78
    },
    {
        "id": 10,
        "name": "Item 10",
        "price": "$10",
        "amount": 30
    },
    {
        "id": 11,
        "name": "Item 11",
        "price": "$11",
        "amount": 32
    },
    {
        "id": 12,
        "name": "Item 12",
        "price": "$12",
        "amount": 12
    },
    {
        "id": 13,
        "name": "Item 13",
        "price": "$13",
        "amount": 76
    },
    {
        "id": 14,
        "name": "Item 14",
        "price": "$14",
        "amount": 10
    },
    {
        "id": 15,
        "name": "Item 15",
        "price": "$15",
        "amount": 9
    },
    {
        "id": 16,
        "name": "Item 16",
        "price": "$16",
        "amount": 8
    },
    {
        "id": 17,
        "name": "Item 17",
        "price": "$17",
        "amount": 1
    },
    {
        "id": 18,
        "name": "Item 18",
        "price": "$18",
        "amount": 99
    },
    {
        "id": 19,
        "name": "Item 19",
        "price": "$19",
        "amount": 100
    },
    {
        "id": 20,
        "name": "Item 20",
        "price": "$20",
        "amount": 109
    }
]

后端nodejs

var total = 300;//這一條要根據sql得到的count數才可以
db.sql(sql, function(err, results) {
                                if (err) {
                                    console.log("出現錯誤:", err);
                                    res.write("出現錯誤,請刷新后重試!");
                                    res.end();
                                } else {
                                    var send_arr = {};
                                    send_arr["total"] = total;
                                    send_arr["rows"] = results;
                                    res.json(send_arr);
                                }
                            })
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

德兴市| 繁峙县| 开鲁县| 永靖县| 双桥区| 沧源| 鹿泉市| 抚松县| 如东县| 略阳县| 泸州市| 青川县| 锡林浩特市| 临沧市| 东阿县| 文化| 四会市| 东台市| 兴城市| 沅陵县| 当阳市| 厦门市| 揭西县| 阳原县| 东平县| 班戈县| 阿合奇县| 醴陵市| 泾阳县| 无极县| 康保县| 常熟市| 马鞍山市| 沾化县| 龙海市| 汝州市| 夏津县| 松溪县| 博野县| 阆中市| 莲花县|