Flexgrid rowSelection issue when using single click edit if 1st col is editable

Posted by: aagarwal23 on 29 June 2020, 12:21 am EST

    • Post Options:
    • Link

    Posted 29 June 2020, 12:21 am EST

    Hi,

    We are using flex grid control in our Angular project and we are using single click cell edit functionality as suggested here - https://www.grapecity.com/kb/send-cell-into-edit-mode-on-single-click-in-angular.

    We are facing an issue with the row selection when the 1st column is not read-only. On selecting row header, instead of selecting the row it is making the 1st cell in edit mode.

    Please find the sample below where the row selection works fine for 1st grid but not for the second grid -

    https://stackblitz.com/edit/wj-flex-selection-issue

    Please help me with a solution for this.

  • Posted 29 June 2020, 5:44 pm EST

    Hi Arpit,

    This is an expected behaviour because the selection is changed when you click on the rowHeaders. To prevent this, you will need to handle the mousedown event on the row headers and set a flag that will be used to check whether the cell should be edited or not.

    Please refer to the sample link below for reference:

    https://stackblitz.com/edit/wj-flex-selection-issue-v7ihvk

    Regards,

    Ashwin

  • Posted 29 June 2020, 6:21 pm EST

    Hi Ashwin,

    Thanks for the response. Can you please help me in understanding why is this not working for this specific scenario where the first column is editable? I also see that selectionChanged event is raised twice only in this case thus cancelling previous row selection during 1st call. This solution does not prevent the multiple calls.

    Regards,

    Arpit

  • Posted 30 June 2020, 5:20 pm EST

    Hi Arpit,

    When the first column is read-only and you click on the row header, the row is selected and the main selection goes to the first cell of the row. Now, in the selectionChanged event, you have called the startEditing method but since the first column is read-only, it does not go into edit mode.

    Now, the same scenario is when the first column can be edited but in this case, the column is editable and the startEditing method edits the grid.

    It does not matter if the selectionChanged is fired once or twice.

    I hope this clears your doubt.

    ~regards

  • Posted 30 June 2020, 8:41 pm EST

    Hi Ashwin,

    I still don’t get why the control will select the first cell of the row as the main selection when I am trying to select the entire row. Anyways, unfortunately the solution provided still doesn’t work for us as it does not allow contiguous row selection. With selection mode as CellRange/ListBox, it is still making 1st cell as editable when trying to select multiple rows using mouse drag.

    We have found a workaround for this using finishEditing(). Please let me know if this can cause any concerns or issues going further or can be improvised.

    Please refer to the sample below -

    https://stackblitz.com/edit/wj-flex-selection-issue-kkv1jh

    ~Arpit

  • Posted 1 July 2020, 5:44 pm EST

    Hi Arpit,

    Let me give you an example. Have you ever used excel? It does not matter whether you have selected a single cell, continuous range, multiple ranges, a single column/row, etc in excel, a cell is always selected (the cell with the white background). FlexGrid also have the same behavior. Whenever you will select a row in excel, the first cell of that row is selected, same goes for FlexGrid.

    Regarding your solution, if it is working as per your expectations, then there is not issue.

    ~regards

  • Posted 1 July 2020, 6:41 pm EST

    Oh Okay. I get it now. Thanks for the clarification. :slight_smile:

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels