How to properly create widget dynamically ?

Hi.

In page i have <div> which html content loaded via ajax.

In this block i want to use CGridView… And i using it (:

Grid showing fine, but all ajax handlers do not working - checkbox clicking, delete button etc.

I done it in that way




$html.='PART OF HTML CONTENT';

                Yii::import('zii.widgets.grid.*');

                $columns = array();


/*HERE GOES COLUMNS FILLING, and than showing grid*/


                $grid = $this->widget('zii.widgets.grid.CGridView', array(

                    'dataProvider' => ORG_OBJECT::model()->getTable($oy_id, $attr['TABLE_ID']),

                    'summaryText' => '{count}',

                    'pager' => array(

                        'footer' => '',

                        'header' => ''

                    ),

                    'template' => "

{summary}{pager}

            \n{items}", 'columns' => $columns

                        ), true);

                $html.= $grid;

            }

            $html.='</div>';

        }

       

        $html.='</form></div>';

        echo $html; //show here

        exit;



Grid showing normal, but any ajax or js events are not working. Also, same issue with Chtml::ajaxSubmitButton() - button exists, ajax - not.

So, how to create widget properly?

No one knows? :(