Moved the code that appends the inline edit anchor into a function and registered it to all Ajax events that complete successfully. The anchor is now appended even after retrieving results over Ajax.

This commit is contained in:
ninadsp
2010-08-04 21:54:35 +05:30
parent b99bad8cdd
commit 3d1a420a6f

View File

@@ -5,6 +5,13 @@
* @version $Id$ * @version $Id$
*/ */
/**
* Get the field name for the current field. Required to construct the query
* for inline editing
*
* @param this_field_obj jQuery object that points to the current field's tr
* @param disp_mode string
*/
function getFieldName(this_field_obj, disp_mode) { function getFieldName(this_field_obj, disp_mode) {
if(disp_mode == 'vertical') { if(disp_mode == 'vertical') {
@@ -26,17 +33,13 @@ function getFieldName(this_field_obj, disp_mode) {
return field_name; return field_name;
} }
$(document).ready(function() {
/** /**
* @var disp_mode current value of the direction in which the table is displayed * The function that iterates over each row in the table_results and appends a
* new inline edit anchor to each table row.
*
* @param string disp_mode
*/ */
var disp_mode = $("#top_direction_dropdown").val(); function appendInlineAnchor(disp_mode) {
$("#top_direction_dropdown, #bottom_direction_dropdown").live('change', function(event) {
disp_mode = $(this).val();
})
if(disp_mode == 'vertical') { if(disp_mode == 'vertical') {
var cloned_row = $('.edit_row_anchor').removeClass('edit_row_anchor').parent('tr').clone(); var cloned_row = $('.edit_row_anchor').removeClass('edit_row_anchor').parent('tr').clone();
@@ -70,6 +73,24 @@ $(document).ready(function() {
} }
}) })
} }
}
$(document).ready(function() {
/**
* @var disp_mode current value of the direction in which the table is displayed
*/
var disp_mode = $("#top_direction_dropdown").val();
$("#top_direction_dropdown, #bottom_direction_dropdown").live('change', function(event) {
disp_mode = $(this).val();
})
appendInlineAnchor(disp_mode);
$("#sqlqueryresults").ajaxSuccess(function() {
appendInlineAnchor(disp_mode);
})
$('<span id="togglequerybox"></span>') $('<span id="togglequerybox"></span>')
.html(PMA_messages['strToggleQueryBox']) .html(PMA_messages['strToggleQueryBox'])