[英]Store / Website Column in Magento 2 Admin Grid - Custom Module`
我在magento 2中创建了一个自定义模块。我有两个表,第一个是主表,另一个是用于商店。 第二个表具有第一个表的主键和商店ID列的外键约束。 我已经成功创建了围栏和表格。 我唯一的问题是我无法在网格中加载商店ID。 我正在使用ui_component方法,这意味着使用xml渲染了网格。 如果有人需要代码,我可以在这里发布,但我相信我在寻找什么是可以理解的。
提前致谢。
检查Magento \\ Cms \\ Block \\ Adminhtml \\ Page \\ Grid
/**
* Check is single store mode
*/
if (!$this->_storeManager->isSingleStoreMode()) {
$this->addColumn(
'store_id',
[
'header' => __('Store View'),
'index' => 'store_id',
'type' => 'store',
'store_all' => true,
'store_view' => true,
'sortable' => false,
'filter_condition_callback' => [$this, '_filterStoreCondition']
]
);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.