Bind Grid to a FormControl

Is there a way to bind the Grid to a FormControl? When I try doing this, I get the error message below:

Cannot find control with name: "myGrid"

Template:

<form [formGroup]="myForm">
    <ejs-grid
        formControlName="myGrid"
    >
   ...
   </ejs-grid>
</form>

Component:

    ...
    ngOnInit() {
        this.myForm = this.formBuilder.group({
            myGrid: ''
        });
    }
    ...

3 Replies

BS Balaji Sekar Syncfusion Team February 20, 2020 01:04 PM UTC

Hi Collin, 
 
Greetings from Syncfusion support 
 
Query : Bind Grid to a Form Control. 
 
Before Proceeding your query, we need some more information about this. 
 
  1. Generally “formControlName” is used only for input element. By this property, you can access the values inside the input box.
  2. But in Grid it does not support the “fromControlName” instead, you can use the Grid ID to access the grid properties.
 
So please share us your full requirement to validate further and give the better response. 
 
Regards 
Balaji Sekar. 



CB Collin Barrett February 20, 2020 03:34 PM UTC

We have a shared component that expects an Angular reactive form to be used as input. The requirement is to use a Grid instance with Selection as an input on that form. So, yes, we were wondering if there is a way to bind a Grid as an input to an Angular reactive form?

Thanks.


BS Balaji Sekar Syncfusion Team February 21, 2020 11:28 AM UTC

Hi Collin, 
 
Greetings from Syncfusion support 
 
Query : Angular reactive form to be used as input 
 
For this query we already have a documentation in our Grid component. Kindly refer that. You can get the details by the following link, 
 
 
Please get back to us if you need further assistance 
 
Regards 
Balaji Sekar. 


Loader.
Up arrow icon