Joomla 乔姆拉!模式,在条件下关闭刷新页面
使用Joomla!v2.5和modal打开一个新的弹出窗口Joomla 乔姆拉!模式,在条件下关闭刷新页面,joomla,joomla2.5,joomla-extensions,joomla-component,Joomla,Joomla2.5,Joomla Extensions,Joomla Component,使用Joomla!v2.5和modal打开一个新的弹出窗口 <a href="index.php?option=com_mycomponent&view=my_view" class="modal" rel="{handler: 'iframe', size: {x: 800, y: 600}}"> 用户将有一些选项(链接),如信息/删除/锁定 选择(单击)一个选项并单击“关闭”按钮后,我需要关闭模式或关闭模式并刷新页面 我总是可以用这样的方法刷新页面 <a hr
<a href="index.php?option=com_mycomponent&view=my_view" class="modal" rel="{handler: 'iframe', size: {x: 800, y: 600}}">
用户将有一些选项(链接),如信息/删除/锁定
选择(单击)一个选项并单击“关闭”按钮后,我需要关闭模式或关闭模式并刷新页面
我总是可以用这样的方法刷新页面
<a href="index.php?option=com_mycomponent&view=my_view" class="modal" rel="{handler:'iframe', size: {x: 800, y: 600},onClose:function(){var js =window.location.reload();}}">
但我需要在以下条件下刷新页面(例如,用户单击“删除”=>refresh,用户单击“信息”=>DoNothing)
想法
感谢onClose处理程序,我建议让它调用您自己的自定义JS方法。在该方法中,处理自定义逻辑以确定是否刷新页面。 所以,在乔姆拉!2.5
modal
弹出窗口由脚本(版本1.3)处理
将onClose
处理程序设置为调用自己的Javascript方法,因此:
onClose:function(){var js=window.location.reload();}
更改:
onClose:function(){checkUserChoice();}
或者如果您保持Javascript整洁的名称空间(如建议的那样)
onClose:function(){mycomponent.checkUserChoice();}
将您的checkUserChoice()
设置为做出决定:
mycomponent.checkUserChoice=函数(){
userChoice=document.id('userOption).value;
如果(userChoice=='delete'){
//刷新我们的页面
}否则{
//做点别的
}
}
然后将自定义Javascript文件加载到视图中:
//获取文档对象
$document=JFactory::getDocument();
$document->addScript('path/to/myscript.js');
或者,如果只需加载一个小方法:
$myscript=是的,但是如何将用户的选择从模式“传递”到父级?