0

祝你今天过得愉快。如何在引导模式中更改 url?我使用 yii 引导扩展进行确认对话框。我有不同的操作 url 按钮列表。

按钮代码

foreach ($Users as $a)
    {
                     $this->widget('bootstrap.widgets.TbButton', array(
                        'label'=>Yii::t('default-ui', 'Remove'),
                        'type'=>'action', 
                        'icon'=>'trash',
                    'size'=>'mini', 
                    'htmlOptions'=>array(
                            'data-toggle'=>'modal',
                                'data-target'=>'#myModal',
)));

};

模态代码:

<?php $this->beginWidget('bootstrap.widgets.TbModal', array('id'=>'myModal')); ?>

<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h4>Removing user</h4>
</div>

<div class="modal-body">
    <p>You really want remove this user?</p>
</div>

<div class="modal-footer">
    <?php 
         $this->widget('bootstrap.widgets.TbButton', array(
        'type'=>'inverse',
        'label'=>'Cancel',
        'url'=>'#',
        'htmlOptions'=>array('data-dismiss'=>'modal'),
    )); 
        $this->widget('bootstrap.widgets.TbButton', array(
        'type'=>'danger',
        'label'=>'Yes, remove',
        //'url'=>Yii::app()->createUrl('users/remove', array('id'=>$a['id'])), // here should be dynamic link for removing profile
    )); 
?>
</div>

<?php $this->endWidget(); ?>
4

2 回答 2

1

尝试这个

 $('#view_more')
      .removeData('modal')
      .modal({
        remote: someURL, //your url
        show: false
      });

一个小演示 FIDDLE DEMO

于 2013-09-10T11:28:18.753 回答
0

尝试这个

<?php $this->widget('bootstrap.widgets.TbButton', array(
      'buttonType'=>'link',
      'url'=> array("/users/remove/{$a['id']}"),
      'type'=>'danger',
      'label'=>'Yes, remove',
      )); ?>
于 2013-09-10T11:35:04.260 回答