数据pk属性未显示在x可编辑CGridview中


data-pk attribute not showing in the x-editable CGridview

我使用x-editable在CGridview中使用内联编辑。http://x-editable.demopage.ru/index.php我使用postgresql作为数据库。问题是,我使用postgres中的函数来编写查询,并且从yii调用这些函数。我使用的数据提供程序是CSqlDataprovider。因此,在使用内联编辑时,数据pk属性不会显示在网格视图中。所以更新不起作用。请帮忙。

尝试将dataProvider的keyField设置为'id'。

dataProvider->keyField ='id';

您可以指定PK在X可编辑列中有一个参数:

$this->widget('editable.EditableField', array(
    'type'         => 'select',
    'model'        => $data,
    'attribute'    => 'user_status',
    'url'          => $this->createUrl('site/updateUser'),
    'pk'           => 'id',
    ));
?>

如果您想要更多详细信息,请向我们提供有关CgridView列和需要保存的数据的更多信息。