I’m having problem displaying another form as cjuidialog box because with my current code, it will display a new window instead.
update button on cgridview
'update'=>array(
'imageUrl'=>$this->createImage("icons/edit.png"),
'options'=>array('style'=>'cursor:pointer;'),
'url'=>'CController::createUrl("/po/local/requestDetails/update", array("id"=>$data->id))',
'click'=>'function( e ){updateItem($(this).attr(url)); $("#dlg-item").dialog( {"title" : "Edit Item"} ).dialog("open");}',)
javascript
function updateItem(e)
{
e.preventDefault();
<?php
echo CHtml::ajax(array(
'url'=>array('//po/local/requestdetails/update/','request_number'=>$parentModel->request_number),
'data'=> "js:$(this).serialize()",
'type'=>'post',
'dataType'=>'json',
'success'=>"function(data)
{
if (data.status == 'failure')
{
$('#dlg-item div.item-section').html(data.div);
// Here is the trick: on submit-> once again this function!
$('#dlg-item div.item-section form').submit(addItem);
} else {
$('#dlg-item div.item-section').html(data.div);
setTimeout(\"$('#dlg-item').dialog('close') \",3000);
$.fn.yiiGridView.update('item-grid');
}
}",
))?>;
return false;
}
Any help is greatly appreciated. Thanks.