Jquery Datatable 數據填充報錯:requested unknown parameter ‘XXX‘ for row xx, column xx 解決方法

前些天發現了一個巨牛的人工智能學習網站,通俗易懂,風趣幽默,忍不住分享一下給大家。點擊跳轉到教程。

報錯如圖:

?

解決方法見官網:https://datatables.net/manual/tech-notes/4

?

摘要如下:

?

Parameter is an integer

?

When?{parameter}?is an integer, DataTables is looking for data from an array. This is usually the case when using DOM sourced data (i.e. the data for the table is read automatically from the document). In this circumstance the requested data doesn't exist in source array - likely because the array isn't long enough. This can occur if:

  • There is a?colspan?or?rowspan?in the?tbody?of the table, which is not supported by DataTables.
  • Using?columns?or?columnDefs?you have specified more columns than there are in the HTML
  • The number of cells in the table does not satisfy the equation?#cells = #columns * #rows(i.e. there are more columns defined in the header than in the table body, or vice-versa).
  • ?

在我的代碼里就是這種情況,參數為Integer 類型。還有參數為:String 、 function 類型的見官網解決方法。

解決方法摘要如下 :

Resolution

?

The key to resolving this error, is to ensure that DataTables has all of the data that is required. Specifically, check the following:

  • colspan?and?rowspan?have not been used in the?tbody?of the table.
  • The equation?#cells = #columns * #rows?is satisfied.
  • If using?columns?ensure that you have specified exactly the number of columns that are present in the HTML for the table.
  • Also if using `dt-init columns, remove any trailing commas you might have at the end of the array. The additional comma can cause issues for older browsers.
  • If using dt-init columnDefs` ensure that you have not specified more columns than there are in the HTML
  • If using?columns.render?or?columns.data?ensure that they are returning a value (no return in Javascript is the same as returning?undefined?which will result in this error).
  • Ensure that the server-side script is completing its execution successfully. Long running scripts can time out for example. The server error logs will give an indication if this is the case.

null?or?undefined?data

null?and?undefined?values in a data source absolutely are valid and very often useful. DataTables warns about the use of them by default, as the majority of the time they are not intended for display - for example, rather than showing?null?in the table, you might want to show?Not yet set, or simply an empty string (empty cell). For this, DataTables has a?columns.defaultContent?option.

With?columns.defaultContent?set, any?null?or?undefined?value will be replaced with the value specified. No warning will be shown in this circumstances.

?

官網解決 例子:https://datatables.net/reference/option/columns.defaultContent

摘要如下:

這個例子對于我這種情況(參數為Integer 且為 null )的解決方法就是給該值設置 默認值。 ?如圖在代碼中加上?" defaultContent " : ?" " ? 就OK了。默認值的具體內容可以自由設置。

?

?

?

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/452139.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/452139.shtml
英文地址,請注明出處:http://en.pswp.cn/news/452139.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Tarjan-縮點

$Tarjan$縮點 Tarjan的第二個應用就是求縮點啦。縮點雖然比割點麻煩一點,但是用處也比割點要大不少。 本來要學另外兩個縮點算法的,但是似乎沒什么用...$MST$里確實有只能有$prim$或者只能用$kruscal$的題目,但是這三種縮點...在網上沒有找到介紹它們之間…

mysqldump參數詳細說明(轉)

Mysqldump參數大全(參數來源于mysql5.5.19源碼) 參數 參數說明 --all-databases , -A 導出全部數據庫。 mysqldump -uroot -p --all-databases --all-tablespaces , -Y 導出全部表空間。 mysqldump -uroot -p --all-databases --all-tablespaces --n…

Diango博客--20.開啟 Django 博客的 RSS 功能

1.Rss簡介 博客提供 RSS 訂閱應該是標配,這樣讀者就可以通過一些聚合閱讀工具訂閱你的博客,時時查看是否有文章更新,而不必每次都跳轉到博客上來查看。現在我們就來為博客添加 RSS 訂閱功能。 RSS(Really Simple Syndication&am…

什么是P2P

P2P技術又稱為點對點傳輸技術。舉個簡單的例子,以便可以更好的理解。比如,以前我們要下載一個文件,我們一定要從服務器下載。有了P2P技術之后,我們可以向其它下載過這個文件的電腦獲取這個文件,我下載完成了這個文件之…

SQL語句使用大全,最常用的sql語句

下列語句部分是Mssql語句,不可以在access中使用. SQL分類: DDL—數據定義語言(Create,Alter,Drop,DECLARE) DML—數據操縱語言(Select,Delete,Update,Insert) DCL—數據控制語言(…

Oracle 的 SQL語句中 decode()函數

decode()函數簡介: 主要作用:將查詢結果翻譯成其他值(即以其他形式表現出來,以下舉例說明); 使用方法: Select decode(columnname,值1,翻譯值1,值2,翻譯值2,...值n,翻譯值…

百度王一男: DevOps 的前提是拆掉業務-開發-測試-運維中間的三面墻

這是一個創建于 375 天前的主題,其中的信息可能已經有所發展或是發生改變。由數人云、優維科技、中生代社區聯合發起的 系列 Meetup 《 DevOps&SRE 超越傳統運維之道》 先后在深圳、北京舉行過兩場 7 月 15 日上海站,敬請期待 ▼ 王一男老師在《 Dev…

linux上mongodb的安裝與卸載

安裝 1.下載安裝包 wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.2.tgz 下載完成后解壓縮壓縮包 tar zxf mongodb-linux-i686-1.8.2.tgz 2. 安裝準備 將mongodb移動到/usr/local/server/mongdb文件夾 mv mongodb-linux-i686-1.8.2 /usr/local/mongodb 創建數據…

面向對象設計的準則

1.模塊化 對象就是模塊 把數據結構和操作這些數據的方法緊密地結合在一起 2.抽象 過程抽象 數據抽象:類 參數化抽象:C的“模板” 3.信息隱藏 通過對象的封裝性實現類,分離了接口與實現,支持信息隱藏 4.弱耦合 某一部分的…

Linux觸發連鎖反應,惠及全球

所謂“連鎖反應”是指,若干個相關的事物,只要一個發生變化,其他都跟著發生變化。在軟件界的“圈子”里面,一般而言,“連鎖反應”這個詞匯是不經常使用的。 4月21日,芬蘭科學院把2012年最高技術成就獎授予Li…

Diango博客--21.實現簡單的全文搜索

文章目錄1. 概述2. 模板:將關鍵詞提交給服務器3. 視圖:查找含有搜索關鍵詞的文章4. 視圖:綁定 URL1. 概述 搜索是一個復雜的功能,但對于一些簡單的搜索任務,我們可以使用 Django Model 層提供的一些內置方法來完成&am…

解決Cannot change version of project facet Dynamic web module to 2.5

見 : http://blog.csdn.net/steveguoshao/article/details/38414145 我們用Eclipse創建Maven結構的web項目的時候選擇了Artifact Id為maven-artchetype-webapp,由于這個catalog比較老,用的servlet還是2.3的,而一般現在至少都是2.5…

shell編程 之 test命令

shell編程里的測試test命令基本可以分為3種數據類型,每種都不一樣。個人更傾向于理解為條件語句的寫法規則,就是test加條件加判斷語句。 1 數值類型 基本可以分為6個判斷:-eq等于,-ne不等于,-gt大于,-lt小于&#xff0…

HTTP 協議知識點總結(一)

在許多大公司的面試中,經常會重點考察面試者的計算機基礎知識。所以對于在計算機網絡、數據結構、操作系統上花費更多的時間和精力,是完全值得的。HTTP 作為應用最為廣泛的網絡協議,不論前端和后端都需要經常接觸。最近決定對 HTTP 進行了一些…

階乘的精確值 大數問題

輸入不超過1000的正整數n,輸出n的階乘的精確結果 樣例輸入:30 樣例輸出:265252859812191058636308480000000 分析: 為了保存結果,需要分析1000!有多大。用計算器算一算不難知道,1000&#x…

Diango博客--22.Django Haystack 全文檢索與關鍵詞高亮

文章目錄1. Django Haystack 簡介2. 安裝 django-haystack和elasticsearch 23. 構建容器來運行 elasticsearch 服務4. 配置 Haystack5. 處理數據6. 配置 URL7. 修改搜索表單8. 創建搜索結果頁面9. 高亮關鍵詞10. 建立索引文件11. 修改搜索引擎為中文分詞12. 防止標題被截斷13. …

Vim和Vi的常用命令

Vim 文本編輯器 1、Vim 和 Vi: 兩者都是多模式編輯器; Vim 是 Vi 升級版,再兼容 Vi 所有指令的同時增加了一些新功能支持; 特點: 語法加亮:使用不同的顏色加亮代碼; 多級撤銷:Vi 只能撤銷一次操…

oracle中 sql語句:start with .. connect by prior.. 用法

前些天發現了一個巨牛的人工智能學習網站,通俗易懂,風趣幽默,忍不住分享一下給大家。點擊跳轉到教程。 我們經常會將一個比較復雜的目錄樹存儲到一個表中。或者將一些部門存儲到一個表中,而這些部門互相有隸屬關系。這個時候你就…

多重繼承和單重繼承

多重繼承(Multiple Inheritance, MI)指的是一個類別可以同時從多于一個父類繼承行為與特征的功能。與單一繼承相對,單一繼承指一個類別只可以繼承自一個父類。