diff --git a/js/sql.js b/js/sql.js index f8ab0bbe22..2df7d56c32 100644 --- a/js/sql.js +++ b/js/sql.js @@ -546,11 +546,11 @@ $(document).ready(function() { if($this_hide.siblings("td:eq(" + i + ")").hasClass("inline_edit") == false) { continue; } - var $this_hide_siblings = $this_hide.siblings("td:eq(" + i + ")").children('span'); + var $this_hide_siblings = $this_hide.siblings("td:eq(" + i + ")"); txt = $this_hide_siblings.data('original_data'); - if($this_hide_siblings.children().length != 0) { - $this_hide_siblings.empty(); - $this_hide_siblings.append(txt); + if($this_hide_siblings.children('span').children().length != 0) { + $this_hide_siblings.children('span').empty(); + $this_hide_siblings.children('span').append(txt); } } $(this).prev().prev().remove(); @@ -585,8 +585,8 @@ $(document).ready(function() { } $this_row_siblings = $this_row.siblings("tr:eq(" + i + ") td:eq(" + pos + ")").children('span'); txt = $this_row_siblings.data('original_data'); - $this_row_siblings.empty(); - $this_row_siblings.append(txt); + $this_row_siblings.children('span').empty(); + $this_row_siblings.children('span').append(txt); } $(this).prev().remove(); $(this).prev().remove(); @@ -633,7 +633,11 @@ $(document).ready(function() { /** * @var this_field Object referring to this field () */ - var $this_field = $(this).children('span'); + var $this_field = $(this); + /** + * @var this_field_span Object referring to this field's child () + */ + var $this_field_span = $(this).children('span'); /** * @var field_name String containing the name of this field. * @see getFieldName() @@ -651,11 +655,11 @@ $(document).ready(function() { /** * @var curr_value String current value of the field (for fields that are of type enum or set). */ - var curr_value = $this_field.text(); + var curr_value = $this_field_span.text(); if($this_field.is(':not(.not_null)')){ // add a checkbox to mark null for all the field that are nullable. - $this_field.html('
Null :
'); + $this_field_span.html('
Null :
'); // check the 'checkbox_null__' if the corresponding value is null if($this_field.is('.null')) { $('.checkbox_null_' + field_name + '_' + this_row_index).attr('checked', true); @@ -702,7 +706,7 @@ $(document).ready(function() { }) } else { - $this_field.html('
'); + $this_field_span.html('
'); } // In each input sibling, wrap the current value in a textarea @@ -710,7 +714,7 @@ $(document).ready(function() { if($this_field.is(':not(.truncated, .transformed, .relation, .enum, .set, .null)')) { // handle non-truncated, non-transformed, non-relation values // We don't need to get any more data, just wrap the value - $this_field.append(''); + $this_field_span.append(''); $this_field.data('original_data', data_value); } else if($this_field.is('.truncated, .transformed')) { @@ -731,8 +735,9 @@ $(document).ready(function() { 'inline_edit' : true }, function(data) { if(data.success == true) { - $this_field.append(''); + $this_field_span.append(''); $this_field.data('original_data', data_value); + $("#sqlqueryresults").trigger('refreshgrid'); } else { PMA_ajaxShowMessage(data.error); @@ -758,8 +763,9 @@ $(document).ready(function() { } $.post('sql.php', post_params, function(data) { - $this_field.append(data.dropdown); + $this_field_span.append(data.dropdown); $this_field.data('original_data', data_value); + $("#sqlqueryresults").trigger('refreshgrid'); }) // end $.post() } else if($this_field.is('.enum')) { @@ -779,8 +785,9 @@ $(document).ready(function() { 'curr_value' : curr_value } $.post('sql.php', post_params, function(data) { - $this_field.append(data.dropdown); + $this_field_span.append(data.dropdown); $this_field.data('original_data', data_value); + $("#sqlqueryresults").trigger('refreshgrid'); }) // end $.post() } else if($this_field.is('.set')) { @@ -801,13 +808,14 @@ $(document).ready(function() { } $.post('sql.php', post_params, function(data) { - $this_field.append(data.select); + $this_field_span.append(data.select); $this_field.data('original_data', data_value); + $("#sqlqueryresults").trigger('refreshgrid'); }) // end $.post() } else if($this_field.is('.null')) { //handle null fields - $this_field.append(''); + $this_field_span.append(''); $this_field.data('original_data', 'NULL'); } }); @@ -836,7 +844,7 @@ $(document).ready(function() { * being edited * */ - var $this_td = $(this).parent().parent(); + var $this_td = $(this).parents('td'); var $test_element = ''; // to test the presence of a element // Initialize variables @@ -1065,10 +1073,11 @@ function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, $input_siblings.each(function() { // Inline edit post has been successful. $this_sibling = $(this); + $this_sibling_span = $(this).children('span'); var is_null = $this_sibling.find('input:checkbox').is(':checked'); if (is_null) { - $this_sibling.html('NULL'); + $this_sibling_span.html('NULL'); $this_sibling.addClass('null'); } else { $this_sibling.removeClass('null'); @@ -1128,9 +1137,12 @@ function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, } } } - $this_sibling.html(new_html); + $this_sibling_span.html(new_html); } }) + + // refresh the grid + $("#sqlqueryresults").trigger('refreshgrid'); } /**