Author Topic: how to reset a 'select' column  (Read 194 times)

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
how to reset a 'select' column
« on: August 13, 2024, 06:07:57 pm »
For a select list like below, that is triggering an action on change,  after the item is selected I would like to clear the selected item and remove the red edit triangle that appears.
In other words, I'd like to reset the field after the item is selected. How could I do that?

                {
                    title: "Actions", editable: true, dataIndx: 'Action', width: 140,
                    editor: {
                        type: 'select',
                        options: ['', 'Edit Resource', 'Remove Resource'],
                        init: function (ui) {
                            ui.$editor.on('change', function () {
                                rowData = ui.rowData
                                rowData.Action = "";
                                if ($(this).val() == "Edit Resource") {
                                    EditResource(rowData);
                                } else if ($(this).val() == "Remove Resource") {
                                    RemoveResource(rowData);
                                }
                                $gridMyTeam.pqGrid('refresh');
                            });
                        }
                    },
                    cls: 'pq-drop-icon pq-side-icon',
                    render: function (ui) {return '<a style="color:blue;text-align:center" >Actions</a>'}
                },

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: how to reset a 'select' column
« Reply #1 on: August 13, 2024, 11:38:27 pm »
Sorry didn't get your question, can you please add more details.

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: how to reset a 'select' column
« Reply #2 on: August 14, 2024, 01:19:13 am »
after a value is selected in the column and the change event runs, I want to reset the column to be blank and not appear as edited (red edit triangle). So, if a user selects that column again, they can choose the same list item and have the changed event fire again.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: how to reset a 'select' column
« Reply #3 on: August 14, 2024, 03:57:24 pm »
Ok, the way I understand it is that select list is used to initiate some actions but you don't want to save its value in column.

Instead of using an editor, you may use column.render to render select list in the cell and column.postRender to bind change event