Skip to content

Commit

Permalink
v0.15.0 - Don't override helper, if it is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
rniemeyer committed Jul 14, 2016
1 parent ed571c7 commit e84cd73
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
22 changes: 12 additions & 10 deletions build/knockout-sortable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// knockout-sortable 0.14.1 | (c) 2016 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
// knockout-sortable 0.15.0 | (c) 2016 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
;(function(factory) {
if (typeof define === "function" && define.amd) {
// AMD anonymous module
Expand Down Expand Up @@ -155,15 +155,17 @@
startActual = sortable.options.start;
updateActual = sortable.options.update;

//ensure draggable table row cells maintain their width while dragging
sortable.options.helper = function(e, ui) {
if (ui.is("tr")) {
ui.children().each(function() {
$(this).width($(this).width());
});
}
return ui;
};
//ensure draggable table row cells maintain their width while dragging (unless a helper is provided)
if ( !sortable.options.helper ) {
sortable.options.helper = function(e, ui) {
if (ui.is("tr")) {
ui.children().each(function() {
$(this).width($(this).width());
});
}
return ui;
};
}

//initialize sortable binding after template binding has rendered in update function
var createTimeout = setTimeout(function() {
Expand Down
4 changes: 2 additions & 2 deletions build/knockout-sortable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "knockout-sortable",
"version": "0.14.1",
"version": "0.15.0",
"author": "Ryan Niemeyer",
"homepage": "https://github.com/rniemeyer/knockout-sortable",
"description": "A Knockout.js binding to connect observableArrays with jQuery UI sortable functionality",
Expand Down
20 changes: 11 additions & 9 deletions src/knockout-sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,17 @@
startActual = sortable.options.start;
updateActual = sortable.options.update;

//ensure draggable table row cells maintain their width while dragging
sortable.options.helper = function(e, ui) {
if (ui.is("tr")) {
ui.children().each(function() {
$(this).width($(this).width());
});
}
return ui;
};
//ensure draggable table row cells maintain their width while dragging (unless a helper is provided)
if ( !sortable.options.helper ) {
sortable.options.helper = function(e, ui) {
if (ui.is("tr")) {
ui.children().each(function() {
$(this).width($(this).width());
});
}
return ui;
};
}

//initialize sortable binding after template binding has rendered in update function
var createTimeout = setTimeout(function() {
Expand Down

0 comments on commit e84cd73

Please sign in to comment.