【问题标题】:Magento grid disable sorting and filteringMagento 网格禁用排序和过滤
【发布时间】:2015-06-10 18:40:32
【问题描述】:

如何禁用 Magento 网格中列的排序和过滤

【问题讨论】:

    标签: sorting magento filter grid


    【解决方案1】:

    最简单的方法是在 _prepareColumns() 方法中进行。

      $this->addColumn('item', array(
          'header'    => Mage::helper('module')->__('Object'),
          'index'     => 'item',
          'filter'    => false,
          'sortable'  => false
      ));
    

    【讨论】:

    • 谢谢阿列克谢,你能告诉我的还有一件事是 'filter' => false 还是 'filter => 'false' 'filter' => false 导致找不到 404 页面
    • 我不确定你的意思。过滤器不应导致 404 错误。究竟什么时候会出错?
    • 如何在 ui_component 上使用它?
    【解决方案2】:

    对于自定义网格中的所有列禁用过滤器,您可以使用以下方法。

    在您的自定义 Grid.php(Block) 文件中设置以下方法$this->setFilterVisibility(false);。

     public function __construct() {
            parent::__construct();            
            $this->setFilterVisibility(false);
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多