2012-10-20 65 views
0

我正在开发一个Joomla 3.0组件。作为示例,我从Joomla文档下载了com_hello组件。后端Joomla 3.0组件JS错误

我正在发生的错误是,当我检查视图列表中的复选框时,出现错误消息TypeError: b is null。这个错误发生在core.js的某处。

通常在2.5中,如果我使用JHtml::_('grid.id',$i,$item->id);代码,并且在我的表单中有<input type="hidden" name="boxchecked" value="0" />字段,它工作正常。

我也看了一下Joomla核心的一些组件,但是我没有找到丢失或者其他错误的东西。

这是我的观点的default.php的代码:

<?php 

// NO DIRECT ACCESS TO THIS FILE 
defined('_JEXEC') or die('Restricted access'); 

JHtml::_('behavior.tooltip'); 
?> 
<form action="<?php echo JRoute::_('index.php?option=com_simplesuite'); ?>" method="post" name="adminForm"> 
    <table class="adminlist"> 
     <thead> 
      <tr> 
       <th>ID</th> 
       <th><input type="checkbox" name="checkall-toggle" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" value="" onclick="Joomla.checkAll(this);" /></th> 
       <th><?php echo JText::_('COM_SIMPLESUITE_TAGCLOUD_ADMINISTRATOR_LIST_NAME'); ?></th> 
       <th><?php echo JText::_('COM_SIMPLESUITE_TAGCLOUD_ADMINISTRATOR_LIST_TAGS'); ?></th> 
       <th><?php echo JText::_('COM_SIMPLESUITE_TAGCLOUD_ADMINISTRATOR_LIST_ACTIONS'); ?></th> 
      </tr> 
     </thead> 
     <tbody> 
      <?php foreach ($this->items as $i => $item) : ?> 
      <tr class="row<?php echo $i%2; ?>"> 
       <td><?php echo $item->id; ?></td> 
       <td><?php echo JHtml::_('grid.id',$i,$item->id); ?></td> 
       <td><?php echo $item->name; ?></td> 
       <td><?php echo ($item->tags) ? $item->tags : JText::_('COM_SIMPLESUITE_TAGCLOUD_ADMINISTRATOR_LIST_EMPTY'); ?></td> 
       <td><a href="#">W</a><a href="#">X</a></td> 
      </tr> 
      <?php endforeach; ?> 
     </tbody> 
     <tfoot> 
      <tr> 
       <td colspan="4"><?php echo $this->pagination->getListFooter(); ?></td> 
      </tr> 
     </tfoot> 
    </table> 
    <div> 
     <input type="hidden" name="task" value="" /> 
     <input type="hidden" name="boxchecked" value="0" /> 
     <?php echo JHtml::_('form.token'); ?> 
    </div> 
</form> 

回答

0

尝试增加给你的脚本的顶部:

window.addEvent('domready', function() { 
    if (typeof jQuery != 'undefined' && typeof MooTools != 'undefined') { 

      Element.implement({ 
       slide:function (how, mode) { 
        return this; 
       } 
      }); 
     } 
    }); 

那大概是mootols冲突下的分辨率是与开发团队。

+0

未的作品,但感谢您的帮助:) –

+0

您使用的是我现在明白com_hello组件。嗯,坏消息是com_hello没有被设计成与当前版本的平台一起工作 - 3.0.1。这是一个旧组件的糟糕改编,即使没有使用引导框架。为了让它起作用,我恐怕必须从头开始重新编码。在这种情况下编写默认视图的正确方法不是com_hello中使用的方法。比如,看一下com_weblinks的默认视图,你就会明白,也许你正在为这个失去一些宝贵的时间。 – McRui

+0

好的谢谢,我会这样做:) –

1

尝试使用此:

<?php echo JHtml::_('grid.checkall'); ?> 

,而不是这样的:

<input type="checkbox" name="checkall-toggle" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" value="" onclick="Joomla.checkAll(this);" /> 

为我工作。

+0

它也适用于我,我试图在Joomla com_hello插件中进行更改 –

0

添加以下字段,它为我工作

<input type="hidden" name="boxchecked" value="" />