selected Row

Hi !
I want to edit just one row so I select the row than i edit, but how can i  know the id of the selected row it helps me to knwo wich row i update in the database
please need help and thanks

5 Replies 1 reply marked as answer

MS Monisha Sivanthilingam Syncfusion Team May 3, 2021 09:30 AM UTC

Hi Doss, 
 
Greetings from Syncfusion support. 
 
We can get the index of the selected record by making use of the getSelectedRowIndexes method in the rowSelected event. We can also get the id of the edited record by making use of the beforeSave request type in the actionBegin event or the save request type in the actionComplete event. 
 
App.component.ts 
public actionBegin(args: any) { 
    if (args.requestType == "beforeSave") { 
      alert("TaskID: " + args.data.TaskID); 
    } 
  } 
  public actionComplete(args: any) { 
    if (args.requestType == "save") { 
      alert("TaskID: " + args.data.TaskID); 
    } 
  } 
  public rowSelected(args: any) { 
    let selectedrowindex: number[] = this.ganttObj.selectionModule.getSelectedRowIndexes(); 
    alert(selectedrowindex); 
  } 
 
 
We have also prepared a sample for your reference. 
 
Please contact us if you require any further assistance. 
 
Regards, 
Monisha. 



DM Doss Med Aziz May 6, 2021 08:42 AM UTC

in Html what should i put as params in the function      (actionComplete)="actionComplete()"  


MS Monisha Sivanthilingam Syncfusion Team May 7, 2021 06:28 AM UTC

Hi Doss, 
 
We enter $event as params in the function in the app.component.html file of our application. The following code snippets demonstrate the solution. 
 
App.component.html 
<ejs-gantt 
    id="ganttDefault" 
    #gantt 
    height="430px" 
    [dataSource]="data" 
    [taskFields]="taskSettings" 
     
              … 
 
    (actionBegin)="actionBegin($event)" 
    (actionComplete)="actionComplete($event)" 
    (rowSelected)="rowSelected($event)" 
  > 
  </ejs-gantt> 
 
 
We have also prepared a sample for your reference. 
 
Please contact us if you require any further assistance. 
 
Regards, 
Monisha. 


Marked as answer

DM Doss Med Aziz May 7, 2021 06:30 PM UTC

Thanks for the help 


PN Preethi Nesakkan Gnanadurai Syncfusion Team May 10, 2021 05:25 AM UTC

Hi Doss, 
  
Most Welcome. 
   
Regards, 
Preethi 


Loader.
Up arrow icon