【发布时间】:2014-02-17 17:27:42
【问题描述】:
在我的 Web 应用程序中,我在索引操作视图中使用网格视图。我需要创建一个名为“book”的按钮,单击该按钮会显示一个显示相关内容的对话框。 我尝试了这段代码,但它对事件没有反应。 我的 index.php 网格视图代码
<h1>Producer Offers</h1>
<?php
$this->widget('bootstrap.widgets.TbGridView',array(
'dataProvider'=>$dataProvider,
'columns'=>array(
'offered_vegetable',
'offered_qty',
'unit_cost',
'unit_delivery_cost',
array(
'class'=>"bootstrap.widgets.TbButtonColumn",
'deleteConfirmation'=>"js:'Do you really want to delete record with Offer name '+$(this).parent().parent().children(':nth-child(2)').text()+'?'",
'template'=>'{view}{book}{delete}',
'buttons' =>array(
'book'=>
array(
'label'=>'book',
'click' =>"js:alert('do u want to book this offer!')"
),
),
),
),
));
?>
刷新页面时会显示,但我想在单击按钮时对事件做出反应,有人帮我解决这个问题
【问题讨论】:
-
控制台有什么错误吗?
-
不,它没有在控制台中显示错误
-
你试过用单引号代替双引号吗? 'class'=>"bootstrap.widgets.TbButtonColumn", and 'click' =>"js:alert('do u want to book this offer!')"
-
你必须使用
'而不是"。
标签: javascript php jquery yii