问题描述
您可以通过标准的管理工具栏按钮向其发送消息.例如:确实删除"消息或其他内容...
The standard admin toolbar buttons have the possibility that you can give them a message. For example: a "really delete" message or something...
JToolBarHelper::deleteList('Do you wanna really delete?', 'controller.delete');
自定义按钮也可以吗?在文档中没有关于此的参数. http://docs.joomla.org/JToolBarHelper/custom
Is that also possible for a custom button? In the documentation is no parameter for this. http://docs.joomla.org/JToolBarHelper/custom
Joomla还有其他解决方案吗?向用户显示一条消息,并在确认后执行我的代码!有可能吗?
Did Joomla have another solution? Show the user a message and after his confirmation... execute my code! Is that possible?
对不起,我的英语不好:)谢谢!
Sorry for my bad english :)thanks!
推荐答案
当然有可能:)
只需将其添加到组件模板视图中(例如:)
Simply add to your component template view (for example:)
administrator/components/com_yourcomponent/views/your_view/tmpl/default.php
此代码:
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'customcontroller.delete')
{
if (confirm(Joomla.JText._('Do you really want to delete these items?'))) {
Joomla.submitform(task);
} else {
return false;
}
}
}
</script>
只需更改任务并编辑消息,就可以开始使用
Just change the task and edit the message and you should be ready to go
这篇关于Joomla自定义工具栏按钮消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!