Yii Framework Forum: Bootstrap Button + Ajax + Modal - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Bootstrap Button + Ajax + Modal I don't get the modal in the button Rate Topic: -----

#1 User is offline   klammeraffe 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 07-September 12
  • Location:Berlin, Germany

Posted 24 February 2013 - 11:52 AM

I have created a TbButton which works fine
$this->widget('bootstrap.widgets.TbButton',array(
        'buttonType' => 'ajaxLink',
        'id' => 'friendship',
        'type' => 'link',
        'label' => $relationship['cancel'],
        'size' => 'small',
        'url' => $this->createURL('/friendship/friendship/requests'),
        'disabled' => false,
        'ajaxOptions' => array(
                'type' => 'Post',
                'url' => $this->createURL('/friendship/friendship/requests'),
                'data' => Yii::app()->request->csrfTokenName."=".Yii::app()->request->getCsrfToken()."&action=cancel&user=".$model->username,
                'success'=>"js:function(vals){
                                $('#yt0').text('".Yii::t('profile','Add as a friend')."');
                                $('#yt0').attr('class','btn btn-warning btn-small');
                                $('#yt1').text('');
                       
                }",
                )
));


But how do I get the modal inside? I tried this:
$this->widget('bootstrap.widgets.TbButton',array(
	'buttonType' => 'ajaxLink',
	'id' => 'friendship',
	'type' => 'link',
	'label' => $relationship['cancel'],
	'size' => 'small',
	'url' => $this->createURL('/friendship/friendship/requests'),
	'disabled' => false,
	'htmlOptions'=>array(
        'data-toggle' => 'modal',
        'ajax' => array(
			'type' => 'Post',
			'url' => $this->createURL('/friendship/friendship/requests'),
			'data' => Yii::app()->request->csrfTokenName."=".Yii::app()->request->getCsrfToken()."&action=cancel&user=".$model->username,
            //'processData' => false,
			'success'=>"js:function(vals){ 
					$('#yt0').text('".Yii::t('profile','Add as a friend')."');
					$('#yt0').attr('class','btn btn-warning btn-small');
					$('#yt1').text('');
				
			}",
			),
        ),
));
but no success.
0

#2 User is offline   ne0d1n 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 07-April 11

Posted 27 February 2013 - 01:22 AM

You probably should use 4-th parameter processOutput=true in renderPatrial in /friendship/friendship/requests
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users