The branch, master has been updated
via 00ae1a135c262ac2ab66393344cb190084ebdc6f (commit)
via c3501a3839de24bb3db215f51e895ff058e6335b (commit)
from f6285413d78cbedfa0503d037240dacf2ee9fe16 (commit)
- Log -----------------------------------------------------------------
commit 00ae1a135c262ac2ab66393344cb190084ebdc6f
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Mon Feb 21 02:07:52 2011 +0530
When multiple raws are being inline edited their controls should not clash with each other.
commit c3501a3839de24bb3db215f51e895ff058e6335b
Author: Madhura Jayaratne <madhura.cj(a)gmail.com>
Date: Mon Feb 21 01:15:40 2011 +0530
Better coordination between 'null' checkbox and corresponding select/editor.
-----------------------------------------------------------------------
Summary of changes:
js/sql.js | 43 ++++++++++++++++++++++++++++---------------
1 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/js/sql.js b/js/sql.js
index 3e6c974..0132a8c 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -410,6 +410,7 @@ $(document).ready(function() {
var where_clause = $(this).parents('tbody').find('tr').find('.where_clause:nth('+this_row_index+')').val();
}
else {
+ var this_row_index = $(this).parent().index();
var $input_siblings = $(this).parent('tr').find('.inline_edit');
var where_clause = $(this).parent('tr').find('.where_clause').val();
}
@@ -444,32 +445,44 @@ $(document).ready(function() {
if($this_field.is(':not(.not_null)')){
// add a checkbox to mark null for all the field that are nullable.
- $this_field.html('<div class="null_div">Null :<input type="checkbox" class="checkbox_null_'+ field_name +'"></div>');
- // check the 'checkbox_null_<field_name>' if the value is null
+ $this_field.html('<div class="null_div">Null :<input type="checkbox" class="checkbox_null_'+ field_name + '_' + this_row_index +'"></div>');
+ // check the 'checkbox_null_<field_name>_<row_index>' if the corresponding value is null
if($this_field.is('.null')) {
- $('.checkbox_null_' + field_name).attr('checked', true);
+ $('.checkbox_null_' + field_name + '_' + this_row_index).attr('checked', true);
}
- // if the select/editor is changed un-check the 'checkbox_null_<field_name>'.
+ // if the select/editor is changed un-check the 'checkbox_null_<field_name>_<row_index>'.
if ($this_field.is('.enum, .set')) {
- var $editor = $this_field.find('select');
+ $this_field.find('select').live('change', function(e) {
+ $('.checkbox_null_' + field_name + '_' + this_row_index).attr('checked', false);
+ })
} else if ($this_field.is('.relation')) {
- var $editor = $this_field.find('select');
+ $this_field.find('select').live('change', function(e) {
+ $('.checkbox_null_' + field_name + '_' + this_row_index).attr('checked', false);
+ })
+ $this_field.find('.browse_foreign').live('click', function(e) {
+ $('.checkbox_null_' + field_name + '_' + this_row_index).attr('checked', false);
+ })
} else {
- var $editor = $this_field.find('textarea');
+ $this_field.find('textarea').live('keypress', function(e) {
+ $('.checkbox_null_' + field_name + '_' + this_row_index).attr('checked', false);
+ })
}
- $editor.live('change', function(e) {
- $('.checkbox_null_' + field_name).attr('checked', false);
- })
- // if 'chechbox_null_<field_name>' is clicked empty the select/editor.
- $('.checkbox_null_' + field_name).bind('click', function(e) {
+ // if 'chechbox_null_<field_name>_<row_index>' is clicked empty the corresponding select/editor.
+ $('.checkbox_null_' + field_name + '_' + this_row_index).bind('click', function(e) {
if ($this_field.is('.enum, .set')) {
$this_field.find('select').selectedIndex = -1;
} else if ($this_field.is('.relation')) {
- $this_field.find('select').attr('value', '');
+ // if the dropdown is there to select the foreign value
+ if ($this_field.find('select').length > 0) {
+ $this_field.find('select').attr('value', '');
+ // if foriegn value is selected by browsing foreing values
+ } else {
+ $this_field.find('span.curr_value').empty();
+ }
} else {
- $this_field.find('textarea').empty();
+ $this_field.find('textarea').val('');
}
})
@@ -661,7 +674,7 @@ $(document).ready(function() {
transformation_fields = true;
}
/**
- * @var is_null String capturing whether 'checkbox_null_<field_name>' is checked.
+ * @var is_null String capturing whether 'checkbox_null_<field_name>_<row_index>' is checked.
*/
var is_null = $this_field.find('input:checkbox').is(':checked');
var value;
hooks/post-receive
--
phpMyAdmin