我想在管理网格的自定义模块中创建动态的“添加”按钮url。我可以从“ Block / Adminhtml / Grid / EditRow.php”中更改它吗?
有什么想法吗?
Xml布局:
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">navmenu_items_grid_sub_list.navmenu_items_grid_sub_list_data</item>
<item name="deps" xsi:type="string">navmenu_items_grid_sub_list.navmenu_items_grid_sub_list_data</item>
</item>
<item name="spinner" xsi:type="string">grid_records_columns</item>
<item name="buttons" xsi:type="array">
<item name="add" xsi:type="array">
<item name="name" xsi:type="string">add</item>
<item name="label" xsi:type="string" translate="true">Add Menu Item</item>
<item name="class" xsi:type="string">primary</item>
<!-- <item name="url" xsi:type="string">*/*/*/action/new/</item> -->
</item>
</item>
</argument>
块构造函数
protected function _construct()
{
$this->_objectId = 'row_id';
$this->_blockGroup = 'Test_Navmenu';
$this->_controller = 'adminhtml_grid';
parent::_construct();
if ($this->_isAllowedAction('Test_Navmenu::edit_row')) {
$this->buttonList->update('save', 'label', __('Save'));
$this->buttonList->update('add', 'url', "/dfsdf");
} else {
$this->buttonList->remove('save');
}
$this->buttonList->remove('reset');
}
这是重要的工作:
$this->buttonList->update('add', 'url', "/dfsdf");