Detail Form Bound to Grid Selected Row

Hi,

I have a requirement to show a grid on one part of the page and a form allowing the user to edit the selected row on another portion of the page.  Something like this:


The grid itself is bound to an DataManager using an ODataV4Adaptor:

        <ejs-grid id="headerList" #headerList

                  [dataSource]="caseNotesData"

                  [query]="query"

          >...columns...</ejs-grid>


  ngOnInit() {
     this.caseNotesData = new DataManager({ url: this.apiService.odataUrl + '/CaseNotes', adaptor: new ODataV4Adaptor() });
     this.query = new Query().expand('Coordinator');
  }

Is there a property on the grid I can bind the form elements to or do I need to set an object's value on the grid's OnSelected event?  

Also, I'd like to leverage the grid's ability to save using the OData adaptor so getting those form values back into the grid and having the grid manage persistence would be helpful.  Can this be done?

Thanks!


1 Reply

MS Manivel Sellamuthu Syncfusion Team February 27, 2020 10:40 AM UTC

Hi Kelly, 

Thanks for contacting us. 

Query#1: Is there a property on the grid I can bind the form elements to or do I need to set an object's value on the grid's OnSelected event?  
 
In Grid, there is no property to bind the rowData to external form elements. If you want to bind the Grid row data to the external forms, as you said you can use rowSelected event of the Grid. Also we suggest you to take a look at  
  1. Grid Dialog edit mode, in which the currently selected row will be shown on a form inside the dialog
  1. Grid Dialog template which allows to use custom form elements  to add and update grid records
Query#2: I'd like to leverage the grid's ability to save using the OData adaptor so getting those form values back into the grid and having the grid manage persistence would be helpful.  Can this be done 
 
Yes. You can use updateRow method to achieve your requirement. After you get the edited form values you can invoke the updateRow method with edited data to save the value in server and Grid. 


Please get back to us, if you need further assistance. 

Regards, 
Manivel 


Loader.
Up arrow icon