The solution was to add the following block in config.xml:
<blocks>
<ebuynow_ebnreports>
<class>Ebuynow_Ebnreports_Block</class>
</ebuynow_ebnreports>
</blocks>
Here is what I found out so far.
This is not complete but it can take you on the right path.
I conducted my tests by modifying the cms page listing ui component.
I added this
<item name="filter_url_params" xsi:type="array">
<item name="page_id" xsi:type="string">*</item>
</item>
in cms_page_listing.xml
inside the dataSource node inside the data/config argument. So now it looks like this
<dataSource name="cms_page_listing_data_source">
<argument name="dataProvider" xsi:type="configurableObject">
<argument name="class" xsi:type="string">Magento\Cms\Ui\Component\DataProvider</argument>
<argument name="name" xsi:type="string">cms_page_listing_data_source</argument>
<argument name="primaryFieldName" xsi:type="string">page_id</argument>
<argument name="requestFieldName" xsi:type="string">id</argument>
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
<item name="update_url" xsi:type="url" path="mui/index/render"/>
<item name="storageConfig" xsi:type="array">
<item name="indexField" xsi:type="string">page_id</item>
</item>
<item name="filter_url_params" xsi:type="array"><!-- my addition -->
<item name="page_id" xsi:type="string">*</item>
</item>
</item>
</argument>
</argument>
</dataSource>
This allows me to call the url ROOT/admin/cms/page/index/key/<form_key_here>/?page_id=2
.
And I see only the page with id 2.
But it does not work for range filters and the filter value is not filled in. It still shows as blank.
Now here is why this is possible.
The dataProvider class for cms pages is Magento\Cms\Ui\Component\DataProvider
.
This one extends Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider
.
This last one contains a protected method called prepareUpdateUrl
protected function prepareUpdateUrl()
{
if (!isset($this->data['config']['filter_url_params'])) {
return;
}
foreach ($this->data['config']['filter_url_params'] as $paramName => $paramValue) {
if ('*' == $paramValue) {
$paramValue = $this->request->getParam($paramName);
}
if ($paramValue) {
$this->data['config']['update_url'] = sprintf(
'%s%s/%s',
$this->data['config']['update_url'],
$paramName,
$paramValue
);
$this->addFilter(
$this->filterBuilder->setField($paramName)->setValue($paramValue)->setConditionType('eq')->create()
);
}
}
}
What this does is to check in the ui component config if there is an element called filter_url_params
. If there is, it takes all the values inside it and checks the request for values matching what's defined in filter_url_params
.
But by default it works only with eq
.
What you can try is to have a custom dataSource for your component where you rewrite the method prepareUpdateUrl
and make it take into account all the request variables you need and maybe add paging to it and range filtering.
Side note: This is a very interesting question. I'm sure a lot of people will need this in the future.
Best Answer
At the moment on Magento 2.3.2 the only working solution requires adding configuration in 2 peaces in List (Grid) UI component:
resizeConfig
for columns config.resizeDefaultWidth
for specific column.resizeEnabled
for specific column (optional).Here is an example:
The answer why this works only in the way I've described is in JS function initResize.