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.
Unfortunately, activation email could not send to your email. Please try again.

How to pass the id of the record clicked using the e-column-command

Thread ID:

Created:

Updated:

Platform:

Replies:

131756 Jul 25,2017 08:40 PM Jul 27,2017 06:14 AM ASP.NET Core 3
loading
Tags: Grid
dsapo
Asked On July 25, 2017 08:40 PM

Hi Support:

I have a button in my grid column like this:

 <e-column header-Text="" width="100">
            <e-column-commands>
                <e-column-command type="assign">
                    <e-button-options content-type="TextOnly" text="Order" click="order"></e-button-options>
                </e-column-command>
            </e-column-commands>
        </e-column>

But I need to retrieve the id of the selected row.  I cant use the following code, because is not compatible with Internet Explorer, and we need to support IE and Chrome:

 function order(args)
 {
         
            var gridInstance = $(args.target.closest(".e-grid")).ejGrid("instance");
            var inx = gridInstance.getIndexByRow(args.target.closest("tr"));
            var data = gridInstance.getCurrentViewData()[inx];
}


What other option I have to get the record whose button was clicked.

Thanks in advanced

David


Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On July 26, 2017 09:58 AM

Hi David,  
 
Thanks for contacting Syncfusion Support.  
 
We are unable to reproduce the problem at our end.  
 
We have prepared a sample that can be downloaded from the following location.  
 
 
Please share the following details to analyze the problem at our end.  
 
  1. Complete code example of the view page (Grid and the events bind to the Grid)
  2. Screenshot with the replication procedure or video demo for the issue
  3. Version of the Essential Studio
 
Regards,  
Seeni Sakthi Kumar S. 


dsapo
Replied On July 26, 2017 11:47 AM

Hi Seeni:

Your sample does not work in IE 11, only in Google Chrome.

Check the attachment.


Thanks again


David


Attachment: Error_11368679.zip

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On July 27, 2017 06:14 AM

Hi David,  
 
We can reproduce the problem in the IE11 Browser running in the Win10 OS. The cause of the problem is the event.target is not a valid jQuery Object. So, the closest property is not available for the specified object. We can overcome this problem by replacing this event.target with the this.element of the Button instance. Refer to the following code example.  
 
<ej-grid id="FlatGrid" allow-paging="true" action-complete="complete" datasource="(IEnumerable<object>)ViewBag.datasource"> 
    <e-columns> 
        <e-column header-Text="" width="100"> 
            <e-column-commands> 
                <e-column-command type="assign"> 
                    <e-button-options content-type="TextOnly" text="Order" click="order"></e-button-options> 
                </e-column-command> 
            </e-column-commands> 
        </e-column> 
    </e-columns> 
</ej-grid> 
 
<script> 
    function order(args) { 
 
        var gridInstance = $(this.element.closest(".e-grid")).ejGrid("instance"); 
        var inx = gridInstance.getIndexByRow(this.element.closest("tr")); 
        var data = gridInstance.getCurrentViewData()[inx]; 
    } 
</script> 
 
Regards,  
Seeni Sakthi Kumar 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.

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.

;