Pass Dataprovider Values To Javascipt

I want to use a Javascript Confirm box from a button in TbGridView however I am having problems passing the data into the javascript. The view is:




$this->widget('bootstrap.widgets.TbGridView', array(

    'type' => 'striped bordered condensed',

    'dataProvider' => $model->coninjob($cid, $job), 

    'filter'=>$model,

    'enablePagination'=>true,

    'summaryText'=>'Displaying {start}-{end} of {count} results.',

    'template' => "{summary}{items}{pager}",

    'columns' => array(

        array('name' => 'trading_name', 'header' => 'Trading Name'),

        array('name' => 'address', 'header'=> 'Address'),

        array('name' => 'abn', 'header' => 'ABN'),

        array('name' => 'newcontractor', 'header'=>'New', 'filter'=>false, 'value'=>'$data["newcontractor"]=="1"?"Yes":"No"'),

        array(

            'class'=>'bootstrap.widgets.TbButtonColumn',

            'template'=>'{cledit}',

            'htmlOptions'=>array(

                'style'=>'width:30px;text-align:center;',

                'class'=>'pull-left',

                        'onclick'=>'js:bootbox.confirm("Confirm Send Email to Contractor?",

                        function(confirmed){

                                if (confirmed) {

                                        window.location.href="index.php?r=ImportTask/email&id='.$data->id.'";

                                }

                        })'

                ),

            'header'=>'Email',

            'buttons'=>array

        (

        'cledit' => array

        (

            'label'=>'Email',

            'imageUrl'=>Yii::app()->request->baseUrl.'/images/edit.png',

           // 'url'=>'"index.php?r=ImportTask/email&id=$data->id&jobid=$data->task_id&contid=$data->provider_id&client=$data->client_id&new=$data->newcontractor"',



The specific problem is in the line




if (confirmed) {

          window.location.href="index.php?r=ImportTask/email&id='.$data->id.'";

                                }



$data->id does not render in the html as a value - How can I pass the $data variables to the javascript?

You might want to move that confirmation over to the cledit button where $data->id is available, e.g.:




'email' => array(

	'label'=>'Email',

	'icon'=>'icon-envelope',

	'url'=>'Yii::app()->createUrl("svctix/emailinvoice", array("id"=>$data->id))',

        'htmlOptions'=>array('Your JavaScript here!'),

),



or else use an Ajax call and get $data->id as a JSON response.