cgridview模态链接传递数据

时间:2014-01-04 13:34:53

标签: yii modal-dialog cgridview

如何传递该行的数据?

在cgridview中:

array(
    'header'=>'Message',
    'type'=>'raw',
    'value' => 'CHtml::link(substr($data->comments, 0, 70)."...","#",array("data-toggle"=>"modal","data-target"=>"#message","data-id" => "$data->comments"))',)

在TbModal下

            <script>
            $(document).ready(function(){   
                        var comments = $this.data('id');
                        $("#message").val(comments);
                }
            );
            </script> 

1 个答案:

答案 0 :(得分:0)

"data-id" => "$data->comments"替换为"data-id" => \'$data->comments\'