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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

147038 Aug 29,2019 03:10 PM UTC Aug 30,2019 01:06 PM UTC Angular - EJ 2 1
loading
Tags: Grid
Jayjit Pandit
Asked On August 29, 2019 03:10 PM UTC

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>

Thiyagu Subramani [Syncfusion]
Replied On August 30, 2019 01:06 PM UTC

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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon