We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

In EJS grid how to show textbox and icon in edit mode and also how to fire event on those textbox or icon click

I want to use a icon and textbox in edit mode and also do some activity on those text change and icon click. Please let me know how I can achieve that.

I have added a icon in in ejs-grid which is showing properly in normal mode. I am also doing some activity on icon click event.

But whenever I am trying to add/edit item from toolbar that icon is not getting displayed in edit mode.

Code Sample:

<e-column headerText='TestName' width="180" textAlign="center" field="unTestName">
<ng-template #template let-data>
<div class="image">
<a class="lnkCname" (click)='OpenModal(data)'>
<i class="fa fa-cog" aria-hidden="true"></i>
</a>
</div>
</ng-template>
</e-column>

1 Reply

TS Thiyagu Subramani Syncfusion Team August 30, 2019 05:06 AM

Hi Jayjit, 
 
Greetings from Syncfusion support. 
 
Thanks for your patience. 
 
We have analyzed the reported query at our end. 
 
Using the property "Column Template and Cell Edit Template," we have achieved your icon maintenance requirement in edit mode. 
Here we have changed the text by clicking the icon using click event and the modified text value will be stored in the database grid using actionBegin event.  
You can bind text box change event and customize it according to your requirement. 
 
Please refer this below code example.  
 
[app.component.html] 
 
<e-column field='OrderDate' headerText='Order Date' width=100> 
                                                <ng-template #editTemplate let-data> 
                                                            <div class="image"> 
                <input id="inp{{data.OrderID}}" class="e-input" name='input' type="text" value={{data.CustomerID}}/> 
                <span class="e-icons e-upload" (click)="changeText($event)"></span> 
            </div> 
        </ng-template> 
        <ng-template #template let-data> 
                        <div class="image"> 
                <input id="inp{{data.OrderID}}" class="e-input" name='input' type="text"  value={{data.CustomerID}}/> 
                <span class="e-icons e-upload" (click)=" changeText($event)"></span> 
            </div>      
        </ng-template> 
      </e-column> 
 
 
 
[app.component.ts] 
 
changeText(args): void { 
    var inputId = args.target.previousElementSibling.id; 
    (document.getElementById(inputId) as HTMLInputElement).value = "Changed"; 
  } 
 
actionBegin(args){ 
    if(args.requestType === 'save'){ 
      args.data.CustomerID = (document.getElementById('inp'+  args.data[this.grid.getPrimaryKeyFieldNames()[0]])as HTMLInputElement).value; 
    } 
  } 
 
 
Refer the help documentation: 
 
 
 
 
Please check the sample link. If your requirement is not met, kindly return to us if you need any help on this. 
 
Regards, 
Thiyagu S 


Loader.
Live Chat Icon For mobile
Up arrow icon