Enable tables inline-editing in lazy-loaded tabs
Previously inline-edit was initialized only the first time the page was loaded which had been preventing inline-edit for the tables which were inside lazy-loaded tabs (i.e. loaded with AJAX-request). Fixed that. Change-Id: I5ec4d28a26cfed6e7eaef783a0d5b17762fd75d5 Closes-Bug: #1389437
This commit is contained in:
parent
fd5e574cc5
commit
2eb9643181
|
@ -213,8 +213,11 @@ horizon.inline_edit = {
|
|||
};
|
||||
|
||||
|
||||
horizon.addInitFunction(horizon.inline_edit.init = function() {
|
||||
$('table').on('click', '.ajax-inline-edit', function (evt) {
|
||||
horizon.addInitFunction(horizon.inline_edit.init = function(parent) {
|
||||
parent = parent || document;
|
||||
var $table = $(parent).find('table');
|
||||
|
||||
$table.on('click', '.ajax-inline-edit', function (evt) {
|
||||
var $this = $(this);
|
||||
var td_element = $this.parents('td').first();
|
||||
|
||||
|
@ -236,17 +239,17 @@ horizon.addInitFunction(horizon.inline_edit.init = function() {
|
|||
evt.preventDefault();
|
||||
};
|
||||
|
||||
$('table').on('click', '.inline-edit-submit', function (evt) {
|
||||
$table.on('click', '.inline-edit-submit', function (evt) {
|
||||
submit_form(evt, this);
|
||||
});
|
||||
|
||||
$('table').on('keypress', '.inline-edit-form', function (evt) {
|
||||
$table.on('keypress', '.inline-edit-form', function (evt) {
|
||||
if (evt.which === 13 && !evt.shiftKey) {
|
||||
submit_form(evt, this);
|
||||
}
|
||||
});
|
||||
|
||||
$('table').on('click', '.inline-edit-cancel', function (evt) {
|
||||
$table.on('click', '.inline-edit-cancel', function (evt) {
|
||||
var $cancel = $(this);
|
||||
var td_element = $cancel.parents('td').first();
|
||||
|
||||
|
@ -256,11 +259,11 @@ horizon.addInitFunction(horizon.inline_edit.init = function() {
|
|||
evt.preventDefault();
|
||||
});
|
||||
|
||||
$('table').on('mouseenter', '.inline_edit_available', function (evt) {
|
||||
$table.on('mouseenter', '.inline_edit_available', function (evt) {
|
||||
$(this).find(".table_cell_action").fadeIn(100);
|
||||
});
|
||||
|
||||
$('table').on('mouseleave', '.inline_edit_available', function (evt) {
|
||||
$table.on('mouseleave', '.inline_edit_available', function (evt) {
|
||||
$(this).find(".table_cell_action").fadeOut(200);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -97,3 +97,5 @@ horizon.addInitFunction(horizon.tabs.init = function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
horizon.tabs.addTabLoadFunction(horizon.inline_edit.init);
|
||||
|
|
Loading…
Reference in New Issue