Skip to content

Commit

Permalink
If grid edit area wider than screen, move to left
Browse files Browse the repository at this point in the history
  • Loading branch information
mynetx committed Nov 22, 2013
1 parent 1615fe1 commit bc62aff
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
30 changes: 29 additions & 1 deletion js/makegrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi

// empty all edit area, then rebuild it based on $td classes
$editArea.empty();
$editArea.removeClass('edit_area_right');

// add show data row link if the data resulted by 'browse distinct values' in table structure
if ($td.find('input').hasClass('data_browse_link')) {
Expand All @@ -723,7 +724,12 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
g.wasEditedCellNull = false;
if ($td.is(':not(.not_null)')) {
// append a null checkbox
$editArea.append('<div class="null_div">Null :<input type="checkbox"></div>');
$editArea.append('<div class="null_div">Null:<input type="checkbox"></div>');

if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}

var $checkbox = $editArea.find('.null_div input');
// check if current <td> is NULL
if ($td.is('.null')) {
Expand Down Expand Up @@ -822,13 +828,21 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$editArea.find('span.curr_value').change(function () {
$(g.cEdit).find('.edit_box').val($(this).text());
});

if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}); // end $.post()

$editArea.show();
$editArea.find('select').live('change', function (e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});
g.isEditCellTextEditable = true;

if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}
else if ($td.is('.enum')) {
//handle enum fields
Expand All @@ -852,12 +866,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$editArea.removeClass('edit_area_loading');
$editArea.append(data.dropdown);
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}); // end $.post()

$editArea.show();
$editArea.find('select').live('change', function (e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});

if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}
else if ($td.is('.set')) {
//handle set fields
Expand All @@ -882,12 +903,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
$editArea.removeClass('edit_area_loading');
$editArea.append(data.select);
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}); // end $.post()

$editArea.show();
$editArea.find('select').live('change', function (e) {
$(g.cEdit).find('.edit_box').val($(this).val());
});

if ($(g.cEdit).offset().left + $editArea.outerWidth() > $(document.body).width()) {
$editArea.addClass('edit_area_right');
}
}
else if ($td.is('.truncated, .transformed')) {
if ($td.is('.to_be_saved')) { // cell has been edited
Expand Down
5 changes: 5 additions & 0 deletions themes/original/css/common.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -2247,6 +2247,11 @@
height: 10em;
}

.cEdit .edit_area_right {
position: absolute;
right: 0;
}

.cEdit .goto_link {
background: #EEE;
color: #555;
Expand Down
5 changes: 5 additions & 0 deletions themes/pmahomme/css/common.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,11 @@
height: 10em;
}

.cEdit .edit_area_right {
position: absolute;
right: 0;
}

.cEdit .goto_link {
background: #EEE;
color: #555;
Expand Down

0 comments on commit bc62aff

Please sign in to comment.