2013-01-17 60 views

回答

0

當您不向我們展示您的代碼片段時,我們無法爲您提供幫助。但讓我做一個瘋狂的猜測。 editablegrid默認使用ID列。所以你必須定義它,如果它沒有列名ID

該插件有一些默認設置屬性,你已經玩過那些?由於該插件沒有任何文件,也沒有在腳本中做任何事情說有關定義列主ID,我會建議你移動到一個更好的記錄數據網格狀http://www.datatables.net/

var props = { 
     name: "", 
     label: "", 
     editable: true, 
     renderable: true, 
     datatype: "string", 
     unit: null, 
     precision: -1, // means that all decimals are displayed 
     nansymbol: '', 
     decimal_point: ',', 
     thousands_separator: '.', 
     unit_before_number: false, 
     bar: true, // is the column to be displayed in a bar chart ? relevant only for numerical columns 
     headerRenderer: null, 
     headerEditor: null, 
     cellRenderer: null, 
     cellEditor: null, 
     cellValidators: [], 
     enumProvider: null, 
     optionValues: null, 
     columnIndex: -1 
}; 
0

你應該在很多改變這種地方

對於刪除操作中loaddata.php

$grid->addColumn('action', 'Action', 'html', NULL, false, 'id'); 

更改爲

$grid->addColumn('action', 'Action', 'html', NULL, false, 'yourprimarykey'); 

在update.php(行沒有39)

if ($stmt = $mysqli->prepare("UPDATE ".$tablename." SET ".$colname." = ? WHERE id = ?")) { 

更改爲

if ($stmt = $mysqli->prepare("UPDATE ".$tablename." SET ".$colname." = ? WHERE yourprimarykey = ?")) { 

在delete.php

if ($stmt = $mysqli->prepare("DELETE FROM ".$tablename." WHERE id = ?")) { 

更改爲

if ($stmt = $mysqli->prepare("DELETE FROM ".$tablename." WHERE yourprimarykey = ?")) { 
相關問題