Php 向CJuiDialog小部件动态添加文本-Yii框架
我试图在Js代码中将文本附加到CJuiDialog小部件中,在CJuiDialog内容中,我有两个按钮 对话框小部件代码Php 向CJuiDialog小部件动态添加文本-Yii框架,php,yii,Php,Yii,我试图在Js代码中将文本附加到CJuiDialog小部件中,在CJuiDialog内容中,我有两个按钮 对话框小部件代码 <?php $this->beginWidget('zii.Widgets.jui.CJuiDialog',array( 'id'=>'update_tasks', 'options'=>array( 'title'=>'Create Tasks', 'autoOpen'=>false, 'modal'=>fa
<?php
$this->beginWidget('zii.Widgets.jui.CJuiDialog',array(
'id'=>'update_tasks',
'options'=>array(
'title'=>'Create Tasks',
'autoOpen'=>false,
'modal'=>false,
'width'=>500,
'height'=>300,
),
));
?>
<table cellspacing="20">
<tr>
<td><?php echo CHtml::button('Add to Current Pending Tasks',array('id'=>'AddPendingTasks'));?></td><td style = "width : 20px"></td>
<td><?php echo CHtml::button('Add to Tasks',array('id'=>'AddTasks'));?></td>
</tr>
</table>
<?php $this->endWidget();?>
我在另一个按钮操作的JS代码中打开此对话框
$('.updatetask_btn').click(function(){
var filterid = $(this).closest('tr').find('select')[0].options[$(this).closest('tr').find('select')[0].selectedIndex].value;
var filtername = $(this).closest('tr').find('select')[0].options[$(this).closest('tr').find('select')[0].selectedIndex].text;
document.getElementById('filter-id').value = filterid;
var div = document.getElementById('update_tasks');
div.innerHTML = '<label><b>'+$('#camp-name').val()+' - '+filtername+'</b></label><br>'+div.innerHTML ;
//----- Here am appending text to the dialog dynamically ---
$('#update_tasks').dialog('open');
});
追加文本将阻止CjuiDialog内容中的两个按钮操作。当我在这里添加文本时,两个按钮onclick操作都不起作用。请告诉我任何想法
事实上,我并不完全理解你的需求,但我总是这样做: 你需要理解并适应你的需求。 主要观点
Yii::app()->clientScript->scriptMap['jquery.js'] = false;
Yii::app()->clientScript->scriptMap['jquery.min.js'] = false;
Yii::app()->clientScript->scriptMap['jquery-ui.js'] = false;
Yii::app()->clientScript->scriptMap['jquery-ui.min.js'] = false;
....
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id'=>'addot-dialog',
'options'=>array(
'title' => 'Aggiungi OT',
'autoOpen' => false,
'width' => 600,
'height' => 'auto',
'closeOnEscape' => true,
// 'close' => 'js:function() { $("table.items").find("tbody tr div.log-active").removeClass("log-active").addClass("log-inactive"); }'
)
));
$this->endWidget('zii.widgets.jui.CJuiDialog');
?>
.....
$loadurlvendita = Yii::app()->createUrl("/otpos/otVendita/",
array("idot" => $this->idot, "codfis" => $this->codfis));
....
单击此处,我打开并用填充let对话框。使用render partial从另一个视图加载
CHtml::link('','',
array('class'=>'be-icon vendita','style'=>'display:block;float:right;padding-right:6px;',
'onClick'=>'$("#venditaot-'.$this->idot.'").dialog("open").load(\''.$loadurlvendita.'\');'
)).
控制器
public function actionOtVendita($idot, $codfis) {
$proprietari = Otpos::model()->getOtposProprietari($idot);
$this->renderPartial('vendita', array('idot' => $idot, 'codfis' => $codfis, 'proprietari' => $proprietari), false, true);
}
我希望它能在某种程度上帮助你更好地满足你的需求