/    Sign up×
Community /Pin to ProfileBookmark

Get Row Index inside column formatter | using YUI 2.8.1

Hi,
In my datatable, last column is an image which is clickable. in column definition, i have added custom formatter for this column that attaches click event handler to this image. this handler creates the destination url based on values in other columns and rowIndex. I get the values in other columns by doing oRecord.getData(‘col1’), oRecord.getData(‘col2’) and so on. But I am not able to get the row index inside this handler.
label: link, formatter: function (el, oRecord, oCol, oData) {
Event.addListener(im, ‘click’, function() {
var part1 = oRecord.getData(‘col1’);
var part2 = oRecord.getData(‘col2’);
}
}

I am not able to use getTrEl and getTrIndex. I need to know it as this rowIndex is a part of my destination URL. when I do this.getTrIndex(oRecord), I get error ‘this.getTrIndex is not a function’.

Please suggest how can i get selected row index inside this formatter function. I cannot use rowSelectEvent as it is fired after link is clicked.

thanks in advance

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @kaanta spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...