I want to prefill my form inputs when trying to edit a row, but the ID won’t pass, unless I type the exact number in the URL. Is there any way of passing the ID? Code below, thanks.
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="styles"/>
<body>
<referenceContainer name="content">
<block class="DiscountDiscountRuleBlockAdminhtmlRule" name="discount_rule_grid">
<block class="MagentoBackendBlockWidgetGrid" name="discount_rule_grid.grid" as="grid">
<arguments>
<argument name="id" xsi:type="string">rule_id</argument>
<argument name="dataSource" xsi:type="object">DiscountDiscountRuleModelResourceModelRuleCollection</argument>
<argument name="default_sort" xsi:type="string">id</argument>
<argument name="default_dir" xsi:type="string">ASC</argument>
<argument name="save_parameters_in_session" xsi:type="string">1</argument>
</arguments>
<block class="MagentoBackendBlockWidgetGridColumnSet" name="discount_rule_grid.grid.columnSet" as="grid.columnSet">
<arguments>
<argument name="rowUrl" xsi:type="array">
<item name="path" xsi:type="string">*/form/index</item>
<item name="params" xsi:type="array">
<item name="id" xsi:type="string">grid.columnSet.rule_id</item>
</item>
</argument>
</arguments>
<block class="MagentoBackendBlockWidgetGridColumn" as="rule_id">
<arguments>
<argument name="header" xsi:type="string" translate="true">ID</argument>
<argument name="index" xsi:type="string">rule_id</argument>
<argument name="type" xsi:type="string">text</argument>
<argument name="column_css_class" xsi:type="string">col-id</argument>
<argument name="header_css_class" xsi:type="string">col-id</argument>
</arguments>
</block>
<block class="MagentoBackendBlockWidgetGridColumn" as="rule_name">
<arguments>
<argument name="header" xsi:type="string" translate="true">Rule Name</argument>
<argument name="index" xsi:type="string">rule_name</argument>
<argument name="type" xsi:type="string">text</argument>
<argument name="column_css_class" xsi:type="string">col-id</argument>
<argument name="header_css_class" xsi:type="string">col-id</argument>
</arguments>
</block>
<block class="MagentoBackendBlockWidgetGridColumn" as="products">
<arguments>
<argument name="header" xsi:type="string" translate="true">Products</argument>
<argument name="index" xsi:type="string">products</argument>
<argument name="type" xsi:type="string">text</argument>
<argument name="column_css_class" xsi:type="string">col-id</argument>
<argument name="header_css_class" xsi:type="string">col-id</argument>
</arguments>
</block>
<block class="MagentoBackendBlockWidgetGridColumn" as="discount_percentage">
<arguments>
<argument name="header" xsi:type="string" translate="true">Discount Percentage</argument>
<argument name="index" xsi:type="string">discount_percentage</argument>
<argument name="type" xsi:type="string">text</argument>
<argument name="column_css_class" xsi:type="string">col-id</argument>
<argument name="header_css_class" xsi:type="string">col-id</argument>
</arguments>
</block>
<block class="MagentoBackendBlockWidgetGridColumn" as="status">
<arguments>
<argument name="header" xsi:type="string" translate="true">Status</argument>
<argument name="index" xsi:type="string">status</argument>
<argument name="type" xsi:type="string">text</argument>
<argument name="column_css_class" xsi:type="string">col-id</argument>
<argument name="header_css_class" xsi:type="string">col-id</argument>
</arguments>
</block>
<block class="MagentoBackendBlockWidgetGridColumn" as="created_at">
<arguments>
<argument name="header" xsi:type="string" translate="true">Created</argument>
<argument name="index" xsi:type="string">created_at</argument>
<argument name="type" xsi:type="string">date</argument>
<argument name="column_css_class" xsi:type="string">col-id</argument>
<argument name="header_css_class" xsi:type="string">col-id</argument>
</arguments>
</block>
<block class="MagentoBackendBlockWidgetGridColumn" as="updated_at">
<arguments>
<argument name="header" xsi:type="string" translate="true">Modified</argument>
<argument name="index" xsi:type="string">updated_at</argument>
<argument name="type" xsi:type="string">date</argument>
<argument name="column_css_class" xsi:type="string">col-id</argument>
<argument name="header_css_class" xsi:type="string">col-id</argument>
</arguments>
</block>
</block>
</block>
</block>
</referenceContainer>
</body>
</page>