I have successfully implemented serialized grid in my custom module. Steps are same as this - Grid serialization in magento 2
However there is only 1 input field - position
. I need 2 input fields - position
and qty
. But when i write 2 input_names
only 1 field gets posted in POST data. I want data of both.
Here is what I have tried so far:
File: /app/code/Vendor/Modulename/Block/Adminhtml/Customgrid/Edit/Tab/Gridfile.php
_prepareColumns
function:
$this->addColumn(
'qty',
[
'header' => __('Qty'),
'name' => 'qty',
'type' => 'number',
'validate_class' => 'validate-number',
'index' => 'qty',
'editable' => true,
'edit_only' => false,
'header_css_class' => 'col-qty',
'column_css_class' => 'col-qty'
]
);
$this->addColumn(
'position'
[
'header' => __('Position'),
'name' => 'position',
'type' => 'number',
'validate_class' => 'validate-number',
'index' => 'position',
'editable' => true,
'edit_only' => false,
'header_css_class' => 'col-position',
'column_css_class' => 'col-position'
]
);
File: /app/code/Vendor/Modulename/view/adminhtml/layout/frontname_controller_action.xml
WAY 1
<argument name="input_names" xsi:type="array">
<item name="position" xsi:type="string">position</item>
<item name="qty" xsi:type="string">qty</item>
</argument>
WAY 2
<argument name="input_names" xsi:type="string">position,qty</item>
</argument>
WAY 3
<argument name="input_names" xsi:type="string">position</item>
</argument>
None of these work. First way only posts qty. Second way gives a blank page. Third way only posts position and not qty.
Any ideas as to what the correct syntax is ?
I have checked core files but all of them only use one input field.