Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Clinkcolumn - Calling Javascript Function And Passing Php Values

$
0
0
I'm new to YII framework, I wanted to create a link column having a image. Clicking image should call a Javascript function, PHP values need to be passed to that javascript function. here is the code,

Quote

array(
'class'=>'CLinkColumn',
'header'=> 'Trades',
'imageUrl' => '/images/view_all.png',
'htmlOptions'=>array('style'=>'text-align:justify'),
'linkHtmlOptions'=>array("id"=>'$data["id"]','onclick'=>'viewTrades($data["id"])')
),


But the HTML is not getting rendered properly. It is getting printed wrongly as,

Quote

<a href="javascript:void(0)" onclick="viewTrades($data['id'])" id='$data['id']'><img alt="Link" src="/images/view_all.png"></a>


Instead i wanted this to be printed as ,

Quote

<a href="javascript:void(0)" onclick="viewTrades(317)" id="317"><img alt="Link" src="/images/view_all.png"></a>


Any help is highly appreciated!!!

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>