我正在使用www.editablegrid.net中的editablegrid,并注意到只要我的表有主键的列id,我的网格就能工作得很好。当我在另一个以custID为键的表上使用它时,它无法更新。
我哪里错了?
发布于 2013-01-17 17:39:33
如果你不给我们看你的代码片段,我们就帮不了你了。但让我胡乱猜测一下。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
};发布于 2016-05-08 21:08:05
您应该在许多地方更改此设置
对于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 = ?")) {https://stackoverflow.com/questions/14375696
复制相似问题