Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Joomla自定义管理按钮操作_Joomla_Helpers_Jtoolbar - Fatal编程技术网

Joomla自定义管理按钮操作

Joomla自定义管理按钮操作,joomla,helpers,jtoolbar,Joomla,Helpers,Jtoolbar,我不知道为什么这不起作用,但是我的自定义按钮操作(任务)在我的组件中没有任何作用。在my view.html.php文件中,我有: JToolBarHelper::custom('reports.export_csv', 'csv', '', 'CSV', false); JToolBarHelper::custom('reports.export_mailchimp', 'mailchimp', '', 'Mailchimp', false); 然后在我的ReportsControllerR

我不知道为什么这不起作用,但是我的自定义按钮操作(任务)在我的组件中没有任何作用。在my view.html.php文件中,我有:

JToolBarHelper::custom('reports.export_csv', 'csv', '', 'CSV', false);
JToolBarHelper::custom('reports.export_mailchimp', 'mailchimp', '', 'Mailchimp', false);

然后在我的ReportsControllerReports文件中,我有两个方法(不仅仅是2个,还有一些其他方法,但它们并不相关),export_csv()和export_mailchimp()。每当我单击按钮时,我都会得到一个JS错误,我认为这会阻止操作执行这些方法中的代码。关于“b是未定义的”。我找不到我的代码与其他Joomla(核心)组件中使用的代码之间的任何差异,因此,如果有人能对这个问题有所了解,我将不胜感激(通常,Joomla论坛完全没有用处)。

您应该覆盖Joomla的JS框架行为
您应该在自定义JS文件中使用该函数:
Joomla.submitbutton=功能(按按钮){
开关(按按钮){
案例“导出简历”:
URL=JURI::base.'index.php?option=yourController&task=export\u cvs&….
$.ajax({
url:url, 类型:邮政等 });
}
}


在我的组件中,everytrhing正常工作

您应该覆盖Joomla的JS框架行为
您应该在自定义JS文件中使用该函数:
Joomla.submitbutton=功能(按按钮){
开关(按按钮){
案例“导出简历”:
URL=JURI::base.'index.php?option=yourController&task=export\u cvs&….
$.ajax({
url:url, 类型:邮政等 });
}
}

在我的组件中,每个Rhing都正常工作

@Cfyzz解决方案工作正常

我将此添加到查看文件:

<script type="text/javascript">

    Joomla.submitbutton = function(pressbutton) {
        switch(pressbutton) {
            case 'google':

                window.location = '<?=JRoute::_( 'http://google.com', false );?>';

            break;
            case 'stackoverflow':

                window.location = '<?=JRoute::_( 'http://stackoverflow.com', false );?>';

            break;
        }

    }
</script>
显然,在这种情况下,您不必使用“JRoute::((“在这种情况下,我用两个示例替换了内部链接,这样更容易理解)。

@Cfyzz解决方案有效

我将此添加到查看文件:

<script type="text/javascript">

    Joomla.submitbutton = function(pressbutton) {
        switch(pressbutton) {
            case 'google':

                window.location = '<?=JRoute::_( 'http://google.com', false );?>';

            break;
            case 'stackoverflow':

                window.location = '<?=JRoute::_( 'http://stackoverflow.com', false );?>';

            break;
        }

    }
</script>

显然,在这种情况下,您不必使用“JRoute::。”。我用两个示例替换了内部链接,这样更容易理解。

谢谢提示!我来试一试。谢谢提示!我来试一试。