Skip to content

Infragistics Community Forum / Web / Ignite UI for jQuery / Get value from selected row on double click

Get value from selected row on double click

New Discussion
Dane
Dane asked on Oct 19, 2011 12:28 AM

I need to get an ID for a selected row based on the row being double clicked.  I already have the event firing, I just need the way to access the grid data:

    $(document).ready(function () {
        $('#InstrumentListGrid').delegate('.ui-iggrid-activerow', 'dblclick', function (e, args) {
           
            get the ID from the grid somehow

            var url = "@Url.Action("Edit", new { id = id })";
            window.location = url;
        });
    });

How can do this?

Sign In to post a reply

Replies

  • 0
    Dane
    Dane answered on Sep 5, 2011 8:08 AM

    Worked it out myself:

        $(document).ready(function () {
            $('#InstrumentListGrid').delegate('.ui-iggrid-activerow', 'dblclick', function (e) { 
                var row =  $('#InstrumentListGrid').igGridSelection('selectedRow');
                var dataview = $('#InstrumentListGrid').data('igGrid').dataSource.dataView();
                var cellValue = dataview[row.index]["ID"];          
                var address = "@Url.Action("Edit")" + "/" + cellValue;
                window.location = address;
            });
        })

    • 0
      Michael Peterson
      Michael Peterson answered on Sep 6, 2011 4:29 PM

      Hello Dane,

      I am following up to see if this matter is resolved.

      Please let me know if I may be of further assistance with this matter.

      Sincerely,
      Mike P.
      Developer Support Engineer
      Infragistics, Inc.
      http://www.infragistics.com

      • 0
        Dane
        Dane answered on Sep 7, 2011 1:26 AM

        Consider it resolved unless you can provide a better answer Mike! 🙂

        Dane.

    • 0
      John
      John answered on Oct 19, 2011 12:06 AM

      Hi danenatoli,

      I tried your solution and it worked great for me too.  I want to understand the code a little more though.

      Could you elaborate on these 2 lines?  Is this syntax documented somewhere I can read up on – especially "ui-iggrid-activerow"?

      $('#InstrumentListGrid').delegate('.ui-iggrid-activerow', 'dblclick', function (e) {

      var dataview = $('#InstrumentListGrid').data('igGrid').dataSource.dataView();

      Thanks,

      John

      • 0
        Dane
        Dane answered on Oct 19, 2011 12:28 AM

        $('#InstrumentListGrid').delegate('.ui-iggrid-activerow', 'dblclick', function (e)

        This is just using the jQuery delegate function to attach a function to the dblclick event of the element. '.ui-iggrid-activerow' is just the selector, which I got from looking at the class that was attached to the element when it became the active row.  See http://api.jquery.com/delegate/ for the jQuery delegate spec.

         

        var dataview = $('#InstrumentListGrid').data('igGrid').dataSource.dataView();

        Again, using the jQuery selector to get the grid – $('#InstrumentListGrid') – I then get the current dataView (the data rows being currently displayed on the page) from the grid datasource, so that I can then access the correct row in the following lines of code.

        HTH,

        Dane.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Dane
Favorites
0
Replies
5
Created On
Oct 19, 2011
Last Post
14 years, 11 months ago

Suggested Discussions

Created by

Created on

Oct 19, 2011 12:28 AM

Last activity on

Oct 19, 2011 12:28 AM