Skip to content

Commit

Permalink
Fixed bug with white-space in editable controls
Browse files Browse the repository at this point in the history
  • Loading branch information
vitmalina committed Sep 16, 2015
1 parent 46c3a49 commit c5c2d7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/less/src/grid.less
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
height: 100%;
pointer-events: auto;
outline: none;
white-space: nowrap;
white-space: pre;
}

.w2ui-grid-columns, .w2ui-grid-fcolumns {
Expand Down
6 changes: 3 additions & 3 deletions src/w2grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2510,7 +2510,7 @@
try {
var val = (this.tagName.toUpperCase() == 'DIV' ? $(this).text() : this.value);
var $sel = $('#grid_'+ obj.name + '_editable');
var style = 'font-family: '+ $(this).css('font-family') + '; font-size: '+ $(this).css('font-size') + ';';
var style = 'font-family: '+ $(this).css('font-family') + '; font-size: '+ $(this).css('font-size') + '; white-space: pre;';
var width = w2utils.getStrWidth(val, style);
if (width + 20 > $sel.width()) {
$sel.width(width + 20);
Expand Down Expand Up @@ -2568,7 +2568,7 @@
originalEvent: (event.originalEvent ? event.originalEvent : event), value_new: new_val,
value_previous: (rec.changes && rec.changes.hasOwnProperty(col.field) ? rec.changes[col.field]: old_val), value_original: old_val
};
if (old_val == null) old_val = '';
// if (old_val == null) old_val = ''; -- do not uncomment, error otherwise
while (true) {
new_val = eventData.value_new;
if ((typeof new_val != 'object' && String(old_val) != String(new_val)) ||
Expand Down Expand Up @@ -5966,7 +5966,7 @@
// need timeout to clean up (otherwise scroll problem)
setTimeout(function () {
$records.find('> table').not('table:first-child').remove();
$summary[0].scrollLeft = obj.last.scrollLeft;
if ($summary[0]) $summary[0].scrollLeft = obj.last.scrollLeft;
}, 1);
obj.resizeRecords();
}
Expand Down

0 comments on commit c5c2d7e

Please sign in to comment.