Support defining row actions that do not show up in any of the links

This commit is contained in:
Matthias Jentsch 2015-10-01 14:23:27 +02:00
parent 2a25063678
commit cb81916a2c
1 changed files with 8 additions and 2 deletions

View File

@ -84,7 +84,7 @@
* @returns {jQuery}
*/
rowActions: function() {
return this.$el.find('tr a.rowaction');
return this.$el.find('tr[href]');
},
/**
@ -416,14 +416,20 @@
var container = evt.target;
var self = evt.data.self;
// initialize all rows with the correct link
// initialize all rows with the correct row action
$('table.action tr, table.action-table tr', container).each(function(idx, el) {
// decide which row action to use: links declared with the class rowaction take
// the highest precedence before hrefs defined in the tr itself and regular links
var $a = $('a[href].rowaction', el).first();
if ($a.length) {
// TODO: Find out whether we leak memory on IE with this:
$(el).attr('href', $a.attr('href'));
return;
}
if ($(el).attr('href') && $(el).attr('href').length) {
return;
}
$a = $('a[href]', el).first();
if ($a.length) {
$(el).attr('href', $a.attr('href'));