summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGábor Hojtsy2008-02-08 18:54:11 (GMT)
committerGábor Hojtsy2008-02-08 18:54:11 (GMT)
commit8e4422306546e6750fed92f1d9115d00f72e33b9 (patch)
tree866758cd92d4d05b6c7ddcce192bf6878aec0f4e
parentceef51d424dfaf422c041fea4cada25d490318bc (diff)
#216904 by theborg, pwolanin: items were not properly ordered in tabledrag.js when more then the number of possible values
-rw-r--r--misc/tabledrag.js9
-rw-r--r--modules/menu/menu.admin.inc1
2 files changed, 9 insertions, 1 deletions
diff --git a/misc/tabledrag.js b/misc/tabledrag.js
index edcb5de..24e7276 100644
--- a/misc/tabledrag.js
+++ b/misc/tabledrag.js
@@ -690,9 +690,16 @@ Drupal.tableDrag.prototype.updateField = function(changedRow, group) {
$('option', targetElement).each(function() {
values.push(this.value);
});
+ var maxVal = values[values.length - 1];
// Populate the values in the siblings.
$(targetClass, siblings).each(function() {
- this.value = values.shift();
+ // If there are more items than possible values, assign the maximum value to the row.
+ if (values.length > 0) {
+ this.value = values.shift();
+ }
+ else {
+ this.value = maxVal;
+ }
});
}
else {
diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc
index 89e6f8b..e564c53 100644
--- a/modules/menu/menu.admin.inc
+++ b/modules/menu/menu.admin.inc
@@ -80,6 +80,7 @@ function _menu_overview_tree_form($tree) {
);
$form[$mlid]['weight'] = array(
'#type' => 'weight',
+ '#delta' => 50,
'#default_value' => isset($form_state[$mlid]['weight']) ? $form_state[$mlid]['weight'] : $item['weight'],
);
$form[$mlid]['mlid'] = array(