溫馨提示×

溫馨提示×

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

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

layui問題之渲染數(shù)據(jù)表格時(shí)僅出現(xiàn)10條數(shù)據(jù)怎么辦

發(fā)布時(shí)間:2021-06-29 15:04:32 來源:億速云 閱讀:342 作者:小新 欄目:web開發(fā)

這篇文章主要為大家展示了“l(fā)ayui問題之渲染數(shù)據(jù)表格時(shí)僅出現(xiàn)10條數(shù)據(jù)怎么辦”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“l(fā)ayui問題之渲染數(shù)據(jù)表格時(shí)僅出現(xiàn)10條數(shù)據(jù)怎么辦”這篇文章吧。

一、問題

ajax獲取服務(wù)端數(shù)據(jù)之后,要?jiǎng)討B(tài)渲染table,但數(shù)據(jù)僅僅數(shù)顯了10條,并沒有渲染所有的數(shù)據(jù)。

二、經(jīng)過

看一下表格需要的數(shù)據(jù),0-9條的數(shù)據(jù)都自動(dòng)有一個(gè)名為LAY_TABLE_INDEX的鍵值對,但10條及之后的數(shù)據(jù)都沒有這個(gè)鍵值對。

很是納悶,這個(gè)表格不帶分頁功能,應(yīng)該不需要寫limit對數(shù)據(jù)進(jìn)行限制

table.render({
    elem: '#orderTable'
    ,height: 400
    ,cols: [[ //標(biāo)題欄
     {field: 'status', title: "訂單狀態(tài)", width: 90}
     ,{field: 'orderSerialNumber', title: "訂單編號", minWidth: 150}
     ,{field: 'logisticsSerialNumber', title: "物流串號", minWidth: 150}
     ,{field: 'curPos', title: "當(dāng)前位置", minWidth: 150}
     ,{field: 'monitoringState', title: "監(jiān)控狀況", width: 140}
     ,{field: 'lastUpdated', title: "更新時(shí)間", width: 145, sort: true}
     ,{field: 'operating', title: "操作", minWidth: 220}
    ]]
    ,data: handleData
    ,even: true
   });

三、結(jié)果

看到官網(wǎng)上寫:limit 參數(shù)(默認(rèn):10)是與你服務(wù)端限定的數(shù)據(jù)條數(shù)一致。就把limit加上去了,并且和服務(wù)端數(shù)據(jù)條數(shù)一致。

table.render({
    elem: '#orderTable'
    ,height: 400
    ,cols: [[ //標(biāo)題欄
     {field: 'status', title: "訂單狀態(tài)", width: 90}
     ,{field: 'orderSerialNumber', title: "訂單編號", minWidth: 150}
     ,{field: 'logisticsSerialNumber', title: "物流串號", minWidth: 150}
     ,{field: 'curPos', title: "當(dāng)前位置", minWidth: 150}
     ,{field: 'monitoringState', title: "監(jiān)控狀況", width: 140}
     ,{field: 'lastUpdated', title: "更新時(shí)間", width: 145, sort: true}
     ,{field: 'operating', title: "操作", minWidth: 220}
    ]]
    ,data: handleData
    ,even: true
    ,limit: limit //顯示的數(shù)量
   });

注:handleData是渲染表格時(shí),表格需要的數(shù)據(jù)

以上是“l(fā)ayui問題之渲染數(shù)據(jù)表格時(shí)僅出現(xiàn)10條數(shù)據(jù)怎么辦”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI