Answer the question
In order to leave comments, you need to log in
How to make ajax link in TbButtonGroup (YiiBooster)?
When creating a list via TbButtonGroup, ajax request does not work. It just refreshes the page and displays the response (no styling, styling, etc.), while with TbButton everything works fine. Here is the code:
$this->widget('bootstrap.widgets.TbButtonGroup', array(
'size' => 'small',
'buttons' => array(
array(
'label' => 'Действия',
'visible'=>Yii::app()->getModule('user')->isAdmin(),
'items' => array(
array(
'label'=>'Удалить',
'buttonType' => 'button',
'type'=>'warning',
'url'=> Yii::app()->createUrl('Posts/Delete', array("id"=>$model->post_id)),
'size'=> 'small',
'htmlOptions'=>array(
'data-toggle'=>'modal',
'data-target'=>'#DeleteModal',
'style'=>"margin-top:10px;margin-left:35px;",
)),
array(
'label'=>'передать ВК',
'buttonType' => 'ajaxButton',
'type'=>'default',
'size'=> 'small',
'url' => Yii::app()->createUrl('posts/SendVK'),
'ajaxOptions' => array(
'type' => 'POST',
'success' => 'function(data)
{
var obj = $.parseJSON(data);
if (obj == null)
{
MessageBox.messageDelay("Произошла ошибка", "error");
}
else
{
MessageBox.messageDelay("Успешно", "success");
}
}',
'data' => array('post_id' => $model->post_id),
),
'htmlOptions'=>array(
'style'=>"margin-top:10px;margin-left:35px;",
)
),
),
))));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question