D
D
des1roer2015-04-30 09:00:13
Yii
des1roer, 2015-04-30 09:00:13

Yii bootstrap modal windows?

I am using bootstrap.
there is such a great development as a modal window
in tbgridview

array(
            'class'=>'bootstrap.widgets.TbButtonColumn',
            'template'=>'{view}',
            'buttons'=>array
            (
                'view' => array
                (    
                    'url' => '$data->id."|".$data->parent_id',              
                    'click' => 'function(){
                        data=$(this).attr("href").split("|")
                        $("#myModalHeader").html(data[1]);
                        $("#myModalBody").load("'.$this->createUrl('view').'&id="+data[0]+"&asModal=true");
                        $("#myModal").modal();
                        return false;
                    }',
                ),

and lower
<div class="modal-header">
        <a class="close" data-dismiss="modal">&times;</a>
        <h4 id="myModalHeader">Modal header</h4>
    </div>
 
    <div class="modal-body" id="myModalBody">
        <p>One fine body...</p>
        <?= $data->date ?>
    </div>
 
    <div class="modal-footer">
        <?php  $this->widget(
            'bootstrap.widgets.TbButton',
            array(
                'label' => 'Close',
                'url' => '#',
                'htmlOptions' => array('data-dismiss' => 'modal'),
            )
        ); ?>
    </div>

so when you click on any element, it displays the
One fine body modal window.
and I want to show all elements. how to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
des1roer, 2015-04-30
@des1roer

index

array(
            'class' => 'bootstrap.widgets.TbButtonColumn',
            'template' => '{view}',
            'buttons' => array
                (
                'view' => array
                    (
                    //'url' => '$data->id."|".$data->parent_id',    
                    'url' => '$data->id',
                    'click' => 'function(){
                		data=$(this).attr("href").split("|")
                		$("#myModalHeader").html(data[0]);
          			$("#myModalBody").load("' . $this->createUrl('modalView') . '/"+data[0]+"");
                		$("#myModal").modal();
                		return false;
                	}',
                ),
            )
        ),
    ),
));
?>

controller
public function actionModalView($id)
    {
        $this->renderPartial('view', array(
            'model' => $this->loadModel($id),
        ));
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question