Javascript 在yii-gridview中更新ajax的更改
我的数据库中有一个简单的表tbl_任务,具有以下属性:Javascript 在yii-gridview中更新ajax的更改,javascript,php,ajax,yii,cgridview,Javascript,Php,Ajax,Yii,Cgridview,我的数据库中有一个简单的表tbl_任务,具有以下属性: id int自动增量 描述varchar 完全布尔 现在我创建了一个gridview。完整属性的值通过复选框显示。应该有可能更改complete属性的值。如果这样做,它应该将更改保存到数据库中。同时,gridview每3秒从数据库中获取一次最新记录 我尝试过调整gridview js文件,但它不起作用 有人知道如何解决我的问题吗 提前多谢。这应该不难做到 1) 为了每3秒更新一次网格,请使用javascript setInterval并
- id int自动增量
- 描述varchar
- 完全布尔
提前多谢。这应该不难做到 1) 为了每3秒更新一次网格,请使用javascript setInterval并调用网格的更新方法:
jQuery('#grid_id_here').yiiGridView('update');
2) 在完整列中,将其设置为“type”=>“raw”
,然后将其设置为“value”
,类似于“id.”>“
3) 定义完成任务的javascript函数
function mark_complete(id) {
// 1. make here a ajax call that updates the task's complete field
// 2. on the success of that ajax call place again the update command to update the grid
}
谢谢我使用selectionchanged属性创建了它,并调用了一个javascript函数