Possible to use component for edit template

Hi,

I wonder if it's possible to use some component within the grid edit template.
Something like 

<script id="template" type="text/ng-template">
<mycomponent></mycomponent>
</script>

which get's the current edited model Entity in some way.



1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team November 20, 2017 05:49 AM UTC

Hi Martin,  
 
Thanks for contacting Syncfusion Support.  
 
We cannot include an angular component within the editTemplate. But we can use the editTemplate events to include element and bind them events. Refer to the following code example.  
 
    this.editTmpl = { 
        create: function (args) { 
            return "<input>" 
        }, 
        read: function (args) { 
            args.ejAutocomplete('suggestionList').css('display', 'none'); 
            return args.ejAutocomplete("getValue"); 
        }, 
        write: function (args) { 
            var data = new ej.DataManager(window.gridData).executeLocal(new ej.Query().select("CustomerID")); 
            args.element.ejAutocomplete({ width: "100%", dataSource: data, enableDistinct: true, value: args.rowdata !== undefined ? args.rowdata["CustomerID"] : "" }); 
        } 
    } 
 
<ej-grid id="Grid" [allowpaging]="true"  > 
 
    <e-columns> 
        <e-column field="CustomerID" headertext="Customer ID" [edittemplate]="editTmpl" width="80"></e-column> 
    </e-columns> 
</ej-grid> 
 
Regards,  
Seeni Sakthi Kumar S. 


Loader.
Up arrow icon