Results 1 to 3 of 3

Thread: Getting value from grid

  1. #1
    Sencha User
    Join Date
    Jun 2017
    Posts
    1

    Default Answered: Getting value from grid

    Hi,
    i have a grid(5 column) with 3rdcolumn having hyperlinks.on click of that hyperlink one popup will come.In that popup to populate data i want the value of that perticular row of 1st column. i mean if i will click the hyper link of (2,3)position(row,col) the i want the value of (2,1) position.

    So how i will do 2 event i.e hyperlink click and getting value of the row.

    please help me....

  2. This is the first approach that came to my mind. You can create a widgetcolumn with a component that encapsulates an anchor element. Then on onWidgetAttach, you grab the widget element and attach a click event listener. From here you have access to the record and you get any data field you want. Here is the column declaration:
    Code:
    text: 'Name',
    xtype: 'widgetcolumn',
    widget: {
        xtype: 'component',
        autoEl: {
            tag: 'a',
            href: '#'
        },
        bind: {
            html: '{record.name}'
        }
    },
    onWidgetAttach: function (col, widget, rec) {
        widget.getEl().on('click', function () {
            alert(rec.get('email'));
        });
    }
    And here is the working fiddle:

  3. #2

    Join Date
    Feb 2011
    Location
    Chisinau, Moldova
    Posts
    316
    Answers
    64

    Default

    This is the first approach that came to my mind. You can create a widgetcolumn with a component that encapsulates an anchor element. Then on onWidgetAttach, you grab the widget element and attach a click event listener. From here you have access to the record and you get any data field you want. Here is the column declaration:
    Code:
    text: 'Name',
    xtype: 'widgetcolumn',
    widget: {
        xtype: 'component',
        autoEl: {
            tag: 'a',
            href: '#'
        },
        bind: {
            html: '{record.name}'
        }
    },
    onWidgetAttach: function (col, widget, rec) {
        widget.getEl().on('click', function () {
            alert(rec.get('email'));
        });
    }
    And here is the working fiddle:

  4. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    This isn't anything in the framework to support hyperlinks within grid cells. Perhaps your links would have the position within the URL?

    UPDATE: I stepped away after opening this thread and didn't refresh before replying. Hopefully chramer's helpful solution does the trick for you.

  5. #4
    Sencha User
    Join Date
    Apr 2013
    Posts
    908
    Answers
    105

    Default

    Simple column renderer and then on cellclick event checking if event target is your link should do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •