0

I have a new module created by me.

Here, I've followed this tutorial:

https://devdocs.magento.com/guides/v2.4/ext-best-practices/tutorials/dynamic-row-system-config.html

In this table, I want a column that indicates the row number. How can I do this?

1 Answer 1

0

Following Changes you can do
In Step 2, near line no 24 - Ranges.php

protected function _prepareToRender()
    {
        $this->addColumn('S_no', ['label' => __('S_no'), 'class' => 'required-entry']);
        $this->addColumn('from_qty', ['label' => __('From'), 'class' => 'required-entry']);
        $this->addColumn('to_qty', ['label' => __('To'), 'class' => 'required-entry']);
       

Edit Removed step 4 changes as it is optional step.

4
  • It will work for the first 2 rows, but I would like the number to be auto-incremented for every row in case I'm adding a new one. Commented May 7, 2021 at 6:57
  • Do you create config.xml by yourself or it is autocreated.. , if yourself you can extend it anynumber of times and increament the S_no manually as you are providing details for from_qty and to_qty also and if from_qty and to_qty is also going autometically and config.xml is created autometically then we need to find out which file is creating config.xml file. and we need to add some code there. Commented May 7, 2021 at 7:04
  • It can't be manually added, think about 200 entries, I just can't add 200 lines in the config.xml Commented May 7, 2021 at 10:21
  • Hey, you are right Step 4 is optional step, So no need to touch the config.xml file(that file is for showing pre-filled rows , actually we don't need any modification there). But what changes we did in Step 2 means we will get the textbox to enter the S_no(not optional) and we can enter S_no while entering the other entities like from_qty. Is it working fine from the browser side ? Commented May 7, 2021 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.