2

<input name="" value="3" id="id_3" class="checkbox admin__control-checkbox" checked="checked" type="checkbox">

I Want to check/unchecked the tags and holidays to attach them to my store as shown in the picture, but the ids of the checkboxes conflict with each other;as they appear duplicate from both tags and holidays- if you check id 3 of holiday it will also check the id 3 of tags, in both grids the ids appear in the format id="id_3".How can I change the format id_x to something like idz_x .

protected function _prepareColumns()
{

        $this->addColumn(
            'in_gmaps',
            [
                'header_css_class'  => 'a-center',
                'type'              => 'checkbox',
                'type' => 'checkbox',
                'name' => 'in_gmaps',
                'values' => $this->_getSelectedProducts(),
                'index' => 'holiday_id',

            ]
        );
    $this->addColumn(
        'holiday_id',
        [
            'header' => __('ID'),
            'sortable' => true,
            'index' => 'holiday_id',
            'header_css_class' => 'col-id',
            'column_css_class' => 'col-id'
        ]
    );
    $this->addColumn('holiday_name', [
        'header'    => __('Title'),
        'align'     =>'left',
        'index'     => 'title',
     ]);
     $this->addColumn('holiday_name', ['header' => __('Holiday Name'), 'index' => 'holiday_name']);
    $this->addColumn('holiday_description', ['header' => __('Holiday Description'), 'index' => 'holiday_description']);
    $this->addColumn(
        'position',
        [
            'header' => __('Position'),
            'type' => 'number',
            'index' => 'position',
            'editable' => 'false'
        ]
    );


    return parent::_prepareColumns();
}

And the entire row is

<tr title="#" class="even _clickable">
<td class="col-in_gmaps">
    <label class="data-grid-checkbox-cell-inner" for="id_3">
    <input name="" value="3" id="id_3" 
    class="checkbox admin__control-   checkbox" type="checkbox">
    <label for="id_3"></label></label>
    <td class="col-ol_id">3</td></tr> 
1

I solved this issue , if someone encounters a similar situation - you can resolve the conflict by adding 'use_index' => true in your _prepareColumns() method. This allows you to choose your custom column ,which can be used as your index for ids.

protected function _prepareColumns()
{

        $this->addColumn(
            'in_xyz',
            [
                'header_css_class' => 'col-select col-massaction',
                'column_css_class' => 'col-select col-massaction',
                'type' => 'checkbox',
                'name' => 'in_xyz',
                'values' => $this->_getSelectedProducts(),
                'index' => 'hu',
                'use_index' => true

            ]
        );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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