Inline editing in Grid with multiple checkbox selection

I have the following requirements for the grid:
- Editing should work with a single click.
- It should be possible to select multiple of rows.My idea was to do this via a checkbox.

The definition of the grid looks like this:

<ejs-grid [dataSource]='m_oUploadPlaeneList' locale='de-DE' allowPaging='true' class="portal-dialog_grid" [pageSettings]='initialPage'  [editSettings]='editSettingsUploadPlan' [selectionSettings]='selectOptionsUploadPlan' [toolbar]='toolbarUploadPlan' #uploadGridCtrl  (load)='load($event)'>
<e-columns>
         <e-column type='checkbox' [allowFiltering]='false' [allowSorting]='false' width='60'></e-column>
                    <e-column field='Dateiname' headerText='Dateiname' width='300' textAlign='Left' isPrimaryKey='true' [allowEditing]='true'></e-column>
.
.
.
</e-columns>
</ejs-grid>

The source is:
this.editSettingsUploadPlan = { allowEditing: true, allowAdding: false, allowDeleting: false };
this.editparamsUploadPlan = { params: { popupHeight: '300px' } };
this.selectOptionsUploadPlan = { type: "Multiple", persistSelection: true, checkboxMode: true, checkboxOnly: true };
this.initialPage = { pageSizes: true, pageCount: 4};

The first try for the load function - mouseup was:

load(args) {

this.uploadGridCtrl.element.addEventListener('mouseup', (e: MouseEventArgs) => {

if ((e.target as HTMLElement).classList.contains("e-rowcell")) {

if (this.uploadGridCtrl.isEdit) {

this.uploadGridCtrl.endEdit();

let index: number = parseInt((e.target as HTMLElement).getAttribute("Index"));

this.uploadGridCtrl.selectRow(index);

this.uploadGridCtrl.startEdit();

}

}

});

}

The problem is that editing no longer works with this.

The second try for the load function - mouseup was:

load(args) {

    this.uploadGridCtrl.element.addEventListener('mouseup', (e: MouseEventArgs) => {
      if ((e.target as HTMLElement).classList.contains("e-rowcell")) {
        if (this.uploadGridCtrl.isEdit)
            this.uploadGridCtrl.endEdit();


        let index: number = parseInt((e.target as HTMLElement).getAttribute("Index"));
        let oSelectedRows: number[] = this.uploadGridCtrl.getSelectedRowIndexes ();


        let oSelectRows: number[] = [index];
        this.uploadGridCtrl.selectRows(oSelectRows);
        this.uploadGridCtrl.startEdit();


        this.uploadGridCtrl.clearRowSelection();
        this.uploadGridCtrl.selectRows(oSelectedRows);
      }
    });
}

Basically the selection and editing works now, but when a row is edited the selection changes. It seems that the selection is always correct one step of editing later.

I've tried a few other things, but I haven't come up with a workable solution.
Please what am I doing wrong? I suspect it's probably just a small thing and the original double click edit function does this small thing differently.

Thanks


6 Replies

RR Rajapandi Ravi Syncfusion Team September 27, 2021 01:54 PM UTC

Hi Gerhard, 

Greetings from Syncfusion support 

Before we start providing solution on your query, we need some information for our clarification. Please share the below details that will be helpful for us to provide better solution. 

1)     Please share the issue replication procedure step by step. 

2)     Please share the issue scenario in video demonstration format. 

3)     Please share your Syncfusion package version. 

Rajapandi R 




GP Gerhard Polzhofer October 1, 2021 05:03 PM UTC

Hi, I have created a small quick example program.

The 2 variants of the load function are included in the source as comment. The editing should work with a single click. Unfortunately, with the first variant of the load function, editing does not work if the row is already selected. With the 2nd variant the editing works, but the function getSelectedRowIndexes in actionBegin or actionComplete returns wrong values. The whole thing is to make it possible to do something with all selected rows in actionComplete.

The used version is 19.0.2.055

Regards,

Gerhard


Attachment: GPSTest01_5934671f.zip


RR Rajapandi Ravi Syncfusion Team October 4, 2021 12:52 PM UTC

Hi Gerhard, 

Thanks for the update 

We have checked your sample and we could see that the single click is not working properly when we are having the checkbox column. We are checking the feasibility to achieve your requirement. So, we need some more time to validate this. We will update you the details on or before 7th Oct 2021. Until then we appreciate your patience. 

Regards, 
Rajapandi R 



RR Rajapandi Ravi Syncfusion Team October 7, 2021 12:23 PM UTC

Hi Gerhard, 

Thanks for your patience 

We have checked your application and we could see that the single click edit was not working properly with the checkbox column. Since we have not passed the target element in the startEdit() method I will not working properly. It was the cause of the problem. To overcome the problem, we suggest you pass the target element in the startEdit() method. Please refer the below modified code example and sample for more information. 


load(args) {      
    // first version 
    this.m_oGridCtrl.element.addEventListener('mouseup', (e: MouseEventArgs) => {       
      if ((e.target as HTMLElement).classList.contains("e-rowcell")) { 
        if (this.m_oGridCtrl.isEdit)  
            this.m_oGridCtrl.endEdit(); 

        let index: number = parseInt((e.target as HTMLElement).getAttribute("Index")); 
        this.m_oGridCtrl.selectRow(index); 
        this.m_oGridCtrl.editModule.startEdit((e.target as HTMLTableCellElement).parentElement as HTMLTableRowElement); 
      } 
    }); 



Please get back to us if you need further assistance with this. 

Regards, 
Rajapandi R 



SS Sarasilmiya Shahul Hameed Syncfusion Team October 11, 2021 05:08 AM UTC

I have a problem with my thread https://www.syncfusion.com/forums/169125/inline-editing-in-grid-with-multiple-checkbox-selection. I can not download the sample corrected by Rajapandi Ravi (thanks by the way). I do not have permission.


RR Rajapandi Ravi Syncfusion Team October 13, 2021 04:07 AM UTC

Hi Gerhard, 

You can download the modified sample in the below-generated link. 


Rajapandi R 



Loader.
Up arrow icon