- Home
- Forum
- ASP.NET Core
- How to pass the id of the record clicked using the e-column-command
How to pass the id of the record clicked using the e-column-command
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
SIGN IN To post a reply.
3 Replies
SS
Seeni Sakthi Kumar Seeni Raj
Syncfusion Team
July 26, 2017 01:58 PM UTC
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.
- Complete code example of the view page (Grid and the events bind to the Grid)
- Screenshot with the replication procedure or video demo for the issue
- Version of the Essential Studio
Regards,
Seeni Sakthi Kumar S.
DS
dsapo
July 26, 2017 03:47 PM UTC
Hi Seeni:
Your sample does not work in IE 11, only in Google Chrome.
Check the attachment.
Thanks again
David
Attachment: Error_11368679.zip
SS
Seeni Sakthi Kumar Seeni Raj
Syncfusion Team
July 27, 2017 10:14 AM UTC
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.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
DS dsapo
- Jul 26, 2017 12:40 AM UTC
- Jul 27, 2017 10:14 AM UTC