Hi,
through a drop down I generate the rows of a table:
<?php echo CHtml::dropDownList('someId','', $someSelectValues,
array(
'ajax' => array(
'type'=>'POST',
'url'=>CController::createUrl('controller/action'),
'update'=>'#tableId',
'data' => array( 'oneVariable'=>'js:jQuery(this).val()',
'anotherVariable'=>'js:jQuery(someId).val()'),
)
)
); ?>
In the controller I then generate the table rows and pass them successfully back to the view where they get displayed.
Now I want a simple javascript to trigger when I click on a table row:
$(\'#tableId tr\').click(function() {
alert($(this).attr(\'id\'));
});
However this doesn’t work if I have it added to the view right in the beginning.
I also tried adding it within the controller action when the drop down list updates the table. In this action I tried adding the javascript with
Yii::app()->clientScript->registerScript('tableRowClick',
'$(\'#tableId tr\').click(function() {
alert($(this).attr(\'id\'));
});');
Again, not successful.
Do you have any idea what else I could try?
[size="3"]My overall goal is to accomplish the following:[/size]
Whenever I click on a table row I’d like another AJAX event to trigger. I would like to update another drop down depending on the table row selected.
If the above doesn’t put me in the right direction, maybe you can point me towards the right way?
Thank you,
jrn