Skip to content

Commit

Permalink
fixed #165
Browse files Browse the repository at this point in the history
  • Loading branch information
Atanas Atanasov committed Sep 30, 2017
1 parent 28ed61a commit ac2af01
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 95 deletions.
59 changes: 29 additions & 30 deletions dist/combined/js/gijgo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2691,7 +2691,7 @@ gj.grid.config = {
decimalDigits: undefined,

/** Template for the content in the column.
* Use curly brackets "{}" to wrap the names of data source columns from server response.
* Use curly brackets '{}' to wrap the names of data source columns from server response.
* @alias column.tmpl
* @type string
* @default undefined
Expand Down Expand Up @@ -3670,7 +3670,7 @@ gj.grid.methods = {
},

renderHeader: function ($grid) {
var data, columns, style, $thead, $row, $cell, i, $checkAllBoxes;
var data, columns, style, $thead, $row, $cell, $title, i, $checkAllBoxes;

data = $grid.data();
columns = data.columns;
Expand All @@ -3695,10 +3695,6 @@ gj.grid.methods = {
$cell.addClass(columns[i].headerCssClass);
}
$cell.css('text-align', columns[i].align || 'left');
if (columns[i].sortable) {
$cell.addClass(style.sortable);
$cell.on('click', gj.grid.methods.createSortHandler($grid, $cell, columns[i]));
}
if ('checkbox' === data.selectionMethod && 'multiple' === data.selectionType &&
'checkbox' === columns[i].type && 'selectRow' === columns[i].role) {
$checkAllBoxes = $cell.find('input[data-role="selectAll"]');
Expand All @@ -3715,7 +3711,12 @@ gj.grid.methods = {
}
});
} else {
$cell.append($('<div data-role="title"/>').html(typeof (columns[i].title) === 'undefined' ? columns[i].field : columns[i].title));
$title = $('<div data-role="title"/>').html(typeof (columns[i].title) === 'undefined' ? columns[i].field : columns[i].title);
$cell.append($title);
if (columns[i].sortable) {
$title.addClass(style.sortable);
$title.on('click', gj.grid.methods.createSortHandler($grid, columns[i]));
}
}
if (columns[i].hidden) {
$cell.hide();
Expand All @@ -3726,7 +3727,7 @@ gj.grid.methods = {
$thead.empty().append($row);
},

createSortHandler: function ($grid, $cell, column) {
createSortHandler: function ($grid, column) {
return function () {
var data, params = {};
if ($grid.count() > 0) {
Expand All @@ -3740,9 +3741,8 @@ gj.grid.methods = {
},

updateHeader: function ($grid) {
var $sortIcon,
var $sortIcon, $cellTitle,
data = $grid.data(),
style = data.style.header,
sortBy = data.params[data.paramNames.sortBy],
direction = data.params[data.paramNames.direction];

Expand All @@ -3751,9 +3751,9 @@ gj.grid.methods = {
if (sortBy) {
position = gj.grid.methods.getColumnPosition($grid.data('columns'), sortBy);
if (position > -1) {
$cell = $grid.find('thead tr th:eq(' + position + ')');
$cellTitle = $grid.find('thead tr th:eq(' + position + ') div[data-role="title"]');
$sortIcon = $('<div data-role="sorticon" class="gj-unselectable" />').append(('desc' === direction) ? data.icons.desc : data.icons.asc);
$cell.append($sortIcon);
$cellTitle.after($sortIcon);
}
}
},
Expand Down Expand Up @@ -7456,22 +7456,20 @@ gj.grid.plugins.resizableColumns = {
$wrapper = $('<div class="gj-grid-column-resizer-wrapper" />');
marginRight = parseInt($column.css('padding-right'), 10) + 3;
$resizer = $('<span class="gj-grid-column-resizer" />').css('margin-right', '-' + marginRight + 'px');
if ($.fn.draggable) {
$resizer.draggable({
start: function () {
$grid.addClass('gj-unselectable');
$grid.addClass('gj-grid-resize-cursor');
},
stop: function () {
$grid.removeClass('gj-unselectable');
$grid.removeClass('gj-grid-resize-cursor');
this.style.removeProperty('top');
this.style.removeProperty('left');
this.style.removeProperty('position');
},
drag: gj.grid.plugins.resizableColumns.private.createResizeHandle($grid, $column, config.columns[i])
});
}
$resizer.draggable({
start: function () {
$grid.addClass('gj-unselectable');
$grid.addClass('gj-grid-resize-cursor');
},
stop: function () {
$grid.removeClass('gj-unselectable');
$grid.removeClass('gj-grid-resize-cursor');
this.style.removeProperty('top');
this.style.removeProperty('left');
this.style.removeProperty('position');
},
drag: gj.grid.plugins.resizableColumns.private.createResizeHandle($grid, $column, config.columns[i])
});
$column.append($wrapper.append($resizer));
}
}
Expand All @@ -7497,7 +7495,7 @@ gj.grid.plugins.resizableColumns = {

configure: function ($grid, fullConfig, clientConfig) {
$.extend(true, $grid, gj.grid.plugins.resizableColumns.public);
if (fullConfig.resizableColumns) {
if (fullConfig.resizableColumns && $.fn.draggable) {
$grid.on('initialized', function () {
gj.grid.plugins.resizableColumns.private.init($grid, fullConfig);
});
Expand Down Expand Up @@ -9165,7 +9163,7 @@ gj.tree.events = {
* }
* });
* tree.on('disable', function (e, node) {
* alert(node.text() + ' is enabled.');
* alert(node.text() + ' is disabled.');
* });
* </script>
*/
Expand Down Expand Up @@ -9302,6 +9300,7 @@ gj.tree.methods = {
}

if (disabled) {
gj.tree.methods.disableNode($tree, $node);
} else {
$expander.on('click', gj.tree.methods.expanderClickHandler($tree));
$display.on('click', gj.tree.methods.displayClickHandler($tree));
Expand Down
6 changes: 3 additions & 3 deletions dist/combined/js/gijgo.min.js

Large diffs are not rendered by default.

56 changes: 27 additions & 29 deletions dist/modular/js/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ gj.grid.messages['en-us'] = {
/** Number of decimal digits after the decimal point. */ decimalDigits: undefined,

/** Template for the content in the column.
* Use curly brackets "{}" to wrap the names of data source columns from server response. */ tmpl: undefined,
* Use curly brackets '{}' to wrap the names of data source columns from server response. */ tmpl: undefined,

/** If set to true stop event propagation when event occur. */ stopPropagation: false,

Expand Down Expand Up @@ -400,7 +400,7 @@ gj.grid.methods = {
},

renderHeader: function ($grid) {
var data, columns, style, $thead, $row, $cell, i, $checkAllBoxes;
var data, columns, style, $thead, $row, $cell, $title, i, $checkAllBoxes;

data = $grid.data();
columns = data.columns;
Expand All @@ -425,10 +425,6 @@ gj.grid.methods = {
$cell.addClass(columns[i].headerCssClass);
}
$cell.css('text-align', columns[i].align || 'left');
if (columns[i].sortable) {
$cell.addClass(style.sortable);
$cell.on('click', gj.grid.methods.createSortHandler($grid, $cell, columns[i]));
}
if ('checkbox' === data.selectionMethod && 'multiple' === data.selectionType &&
'checkbox' === columns[i].type && 'selectRow' === columns[i].role) {
$checkAllBoxes = $cell.find('input[data-role="selectAll"]');
Expand All @@ -445,7 +441,12 @@ gj.grid.methods = {
}
});
} else {
$cell.append($('<div data-role="title"/>').html(typeof (columns[i].title) === 'undefined' ? columns[i].field : columns[i].title));
$title = $('<div data-role="title"/>').html(typeof (columns[i].title) === 'undefined' ? columns[i].field : columns[i].title);
$cell.append($title);
if (columns[i].sortable) {
$title.addClass(style.sortable);
$title.on('click', gj.grid.methods.createSortHandler($grid, columns[i]));
}
}
if (columns[i].hidden) {
$cell.hide();
Expand All @@ -456,7 +457,7 @@ gj.grid.methods = {
$thead.empty().append($row);
},

createSortHandler: function ($grid, $cell, column) {
createSortHandler: function ($grid, column) {
return function () {
var data, params = {};
if ($grid.count() > 0) {
Expand All @@ -470,9 +471,8 @@ gj.grid.methods = {
},

updateHeader: function ($grid) {
var $sortIcon,
var $sortIcon, $cellTitle,
data = $grid.data(),
style = data.style.header,
sortBy = data.params[data.paramNames.sortBy],
direction = data.params[data.paramNames.direction];

Expand All @@ -481,9 +481,9 @@ gj.grid.methods = {
if (sortBy) {
position = gj.grid.methods.getColumnPosition($grid.data('columns'), sortBy);
if (position > -1) {
$cell = $grid.find('thead tr th:eq(' + position + ')');
$cellTitle = $grid.find('thead tr th:eq(' + position + ') div[data-role="title"]');
$sortIcon = $('<div data-role="sorticon" class="gj-unselectable" />').append(('desc' === direction) ? data.icons.desc : data.icons.asc);
$cell.append($sortIcon);
$cellTitle.after($sortIcon);
}
}
},
Expand Down Expand Up @@ -2657,22 +2657,20 @@ gj.grid.plugins.inlineEditing.configure = function ($grid, fullConfig, clientCon
$wrapper = $('<div class="gj-grid-column-resizer-wrapper" />');
marginRight = parseInt($column.css('padding-right'), 10) + 3;
$resizer = $('<span class="gj-grid-column-resizer" />').css('margin-right', '-' + marginRight + 'px');
if ($.fn.draggable) {
$resizer.draggable({
start: function () {
$grid.addClass('gj-unselectable');
$grid.addClass('gj-grid-resize-cursor');
},
stop: function () {
$grid.removeClass('gj-unselectable');
$grid.removeClass('gj-grid-resize-cursor');
this.style.removeProperty('top');
this.style.removeProperty('left');
this.style.removeProperty('position');
},
drag: gj.grid.plugins.resizableColumns.private.createResizeHandle($grid, $column, config.columns[i])
});
}
$resizer.draggable({
start: function () {
$grid.addClass('gj-unselectable');
$grid.addClass('gj-grid-resize-cursor');
},
stop: function () {
$grid.removeClass('gj-unselectable');
$grid.removeClass('gj-grid-resize-cursor');
this.style.removeProperty('top');
this.style.removeProperty('left');
this.style.removeProperty('position');
},
drag: gj.grid.plugins.resizableColumns.private.createResizeHandle($grid, $column, config.columns[i])
});
$column.append($wrapper.append($resizer));
}
}
Expand All @@ -2698,7 +2696,7 @@ gj.grid.plugins.inlineEditing.configure = function ($grid, fullConfig, clientCon

configure: function ($grid, fullConfig, clientConfig) {
$.extend(true, $grid, gj.grid.plugins.resizableColumns.public);
if (fullConfig.resizableColumns) {
if (fullConfig.resizableColumns && $.fn.draggable) {
$grid.on('initialized', function () {
gj.grid.plugins.resizableColumns.private.init($grid, fullConfig);
});
Expand Down
4 changes: 2 additions & 2 deletions dist/modular/js/grid.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/modular/js/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ gj.tree.methods = {
}

if (disabled) {
gj.tree.methods.disableNode($tree, $node);
} else {
$expander.on('click', gj.tree.methods.expanderClickHandler($tree));
$display.on('click', gj.tree.methods.displayClickHandler($tree));
Expand Down
2 changes: 1 addition & 1 deletion dist/modular/js/tree.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/tree/Tree.Base.disable.Event.Sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
});
tree.on('disable', function (e, node) {
alert(node.text() + ' is enabled.');
alert(node.text() + ' is disabled.');
});
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/grid/js/grid.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ gj.grid.config = {
decimalDigits: undefined,

/** Template for the content in the column.
* Use curly brackets "{}" to wrap the names of data source columns from server response.
* Use curly brackets '{}' to wrap the names of data source columns from server response.
* @alias column.tmpl
* @type string
* @default undefined
Expand Down
22 changes: 11 additions & 11 deletions src/grid/js/grid.base.methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ gj.grid.methods = {
},

renderHeader: function ($grid) {
var data, columns, style, $thead, $row, $cell, i, $checkAllBoxes;
var data, columns, style, $thead, $row, $cell, $title, i, $checkAllBoxes;

data = $grid.data();
columns = data.columns;
Expand All @@ -143,10 +143,6 @@ gj.grid.methods = {
$cell.addClass(columns[i].headerCssClass);
}
$cell.css('text-align', columns[i].align || 'left');
if (columns[i].sortable) {
$cell.addClass(style.sortable);
$cell.on('click', gj.grid.methods.createSortHandler($grid, $cell, columns[i]));
}
if ('checkbox' === data.selectionMethod && 'multiple' === data.selectionType &&
'checkbox' === columns[i].type && 'selectRow' === columns[i].role) {
$checkAllBoxes = $cell.find('input[data-role="selectAll"]');
Expand All @@ -163,7 +159,12 @@ gj.grid.methods = {
}
});
} else {
$cell.append($('<div data-role="title"/>').html(typeof (columns[i].title) === 'undefined' ? columns[i].field : columns[i].title));
$title = $('<div data-role="title"/>').html(typeof (columns[i].title) === 'undefined' ? columns[i].field : columns[i].title);
$cell.append($title);
if (columns[i].sortable) {
$title.addClass(style.sortable);
$title.on('click', gj.grid.methods.createSortHandler($grid, columns[i]));
}
}
if (columns[i].hidden) {
$cell.hide();
Expand All @@ -174,7 +175,7 @@ gj.grid.methods = {
$thead.empty().append($row);
},

createSortHandler: function ($grid, $cell, column) {
createSortHandler: function ($grid, column) {
return function () {
var data, params = {};
if ($grid.count() > 0) {
Expand All @@ -188,9 +189,8 @@ gj.grid.methods = {
},

updateHeader: function ($grid) {
var $sortIcon,
var $sortIcon, $cellTitle,
data = $grid.data(),
style = data.style.header,
sortBy = data.params[data.paramNames.sortBy],
direction = data.params[data.paramNames.direction];

Expand All @@ -199,9 +199,9 @@ gj.grid.methods = {
if (sortBy) {
position = gj.grid.methods.getColumnPosition($grid.data('columns'), sortBy);
if (position > -1) {
$cell = $grid.find('thead tr th:eq(' + position + ')');
$cellTitle = $grid.find('thead tr th:eq(' + position + ') div[data-role="title"]');
$sortIcon = $('<div data-role="sorticon" class="gj-unselectable" />').append(('desc' === direction) ? data.icons.desc : data.icons.asc);
$cell.append($sortIcon);
$cellTitle.after($sortIcon);
}
}
},
Expand Down
32 changes: 15 additions & 17 deletions src/grid/js/grid.resizableColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,20 @@ gj.grid.plugins.resizableColumns = {
$wrapper = $('<div class="gj-grid-column-resizer-wrapper" />');
marginRight = parseInt($column.css('padding-right'), 10) + 3;
$resizer = $('<span class="gj-grid-column-resizer" />').css('margin-right', '-' + marginRight + 'px');
if ($.fn.draggable) {
$resizer.draggable({
start: function () {
$grid.addClass('gj-unselectable');
$grid.addClass('gj-grid-resize-cursor');
},
stop: function () {
$grid.removeClass('gj-unselectable');
$grid.removeClass('gj-grid-resize-cursor');
this.style.removeProperty('top');
this.style.removeProperty('left');
this.style.removeProperty('position');
},
drag: gj.grid.plugins.resizableColumns.private.createResizeHandle($grid, $column, config.columns[i])
});
}
$resizer.draggable({
start: function () {
$grid.addClass('gj-unselectable');
$grid.addClass('gj-grid-resize-cursor');
},
stop: function () {
$grid.removeClass('gj-unselectable');
$grid.removeClass('gj-grid-resize-cursor');
this.style.removeProperty('top');
this.style.removeProperty('left');
this.style.removeProperty('position');
},
drag: gj.grid.plugins.resizableColumns.private.createResizeHandle($grid, $column, config.columns[i])
});
$column.append($wrapper.append($resizer));
}
}
Expand All @@ -93,7 +91,7 @@ gj.grid.plugins.resizableColumns = {

configure: function ($grid, fullConfig, clientConfig) {
$.extend(true, $grid, gj.grid.plugins.resizableColumns.public);
if (fullConfig.resizableColumns) {
if (fullConfig.resizableColumns && $.fn.draggable) {
$grid.on('initialized', function () {
gj.grid.plugins.resizableColumns.private.init($grid, fullConfig);
});
Expand Down
Loading

0 comments on commit ac2af01

Please sign in to comment.