javascript - 在 yii 中为 GridView 的点击事件创建警报按钮

标签 javascript php jquery yii

在我的网络应用程序中,我在索引操作 View 中使用 GridView 。我需要创建一个名为“book”的按钮,单击该按钮会显示一个显示相关内容的对话框。 我试过这段代码,但它没有对事件使用react。 我的 index.php GridView 代码

<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!')" 


                ),
        ),
                        ),
                ),

        )); 
?>

刷新页面时会显示,但我想在单击按钮时对事件使用react,任何人都可以帮助我解决此问题

最佳答案

您可以为此使用选项:

'book'=> array(
    'label'=>'book',
    'options' => array(  // set all kind of html options in here
        'onclick' =>"js:alert('do u want to book this offer!')",
         'style' => 'font-weight: bold',
    ),
 )

关于javascript - 在 yii 中为 GridView 的点击事件创建警报按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21835520/

相关文章:

javascript - 尽可能多地匹配组的正则表达式

php - GAE ftp_nlist() 不起作用

列排序中的 jqueryui portlet

javascript - 无法在程序启动时获取隐藏选项

jquery - 回发后显示 jQueryUI 模态

javascript - 通过书签样式访问链接?

javascript - 使用javascript动态推送元素

javascript - 如何检查 JSON 对象数组是否包含数组中定义的值?

php - jQuery 自动完成功能无法连接到 mySQL 数据库

php - AWS SES 将休假响应者视为退回