2amigos / yiiwheels

Widget extension library for the YiiStrap extension
http://yiiwheels.2amigos.us
Other
133 stars 77 forks source link

WhMultiSelect not properly show #131

Closed mirjalal closed 10 years ago

mirjalal commented 10 years ago

Hi.

When I use renderPartial(), the widget crashes.. If you want I can share my codes.

Thanks

tonydspaniard commented 10 years ago

@mirjalal please do, as I do not know what is going on. Mind sharing also the error? Thanks

mirjalal commented 10 years ago

in controller

<?php
public function actionSech ($radio)
{
    $maraq = new Maraq;

    $sql = Yii::app()->db->createCommand()
        ->select ('m.maraq')
        ->from ('maraq m')
        ->where ('m.idsinif=:ids', [':ids'=>$radio])
        ->queryAll();

    $this->renderPartial('sech', array('sql'=>$sql, 'radio'=>$radio, 'maraq'=>$maraq));
}
?>

in sech.php view file

<?php
//    $data1 = CHtml::listData(Maraq::model()->findAll($criteria), 'idmaraq', 'maraq');
    $data1 = $sql;
    $this->widget('yiiwheels.widgets.multiselect.WhMultiSelect', array(
        'model'=>$maraq,
        'name' => 'coxlu_checkbox',
        'data' => array(
            $data1,
        )
    ));
?>

at this scene multiselect group seens like standart listbox. Thanks.

tonydspaniard commented 10 years ago

That doesn't look correct. It should be as shown here: http://www.yiiframework.com/doc/api/1.1/CHtml/#listData-detail and array where the keys are the values of the option in dropdown and their values the text. I believe it should be 'data'=>$data1

mirjalal commented 10 years ago

'data'=>$data is not working. Thanks

tonydspaniard commented 10 years ago

What does the queryAll() returns?

mirjalal commented 10 years ago

queryAll() returns what I want.

what I want to see: 1

but what I have: 2

So in the sech.php the widget seems like 'list box that no style applied'.

tonydspaniard commented 10 years ago

As you can see the elements are there... but is missing text... have you checked whether the CSS is registered?

mirjalal commented 10 years ago

thanks. I solved problem. It's just a little mistake in my codes... :))

tonydspaniard commented 10 years ago

@mirjalal would be great if you post your solution here... Just in case other people encounter the same issue.