Commit 8e442230 authored by Gábor Hojtsy's avatar Gábor Hojtsy

#216904 by theborg, pwolanin: items were not properly ordered in tabledrag.js...

#216904 by theborg, pwolanin: items were not properly ordered in tabledrag.js when more then the number of possible values
parent ceef51d4
...@@ -690,9 +690,16 @@ Drupal.tableDrag.prototype.updateField = function(changedRow, group) { ...@@ -690,9 +690,16 @@ Drupal.tableDrag.prototype.updateField = function(changedRow, group) {
$('option', targetElement).each(function() { $('option', targetElement).each(function() {
values.push(this.value); values.push(this.value);
}); });
var maxVal = values[values.length - 1];
// Populate the values in the siblings. // Populate the values in the siblings.
$(targetClass, siblings).each(function() { $(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 { else {
......
...@@ -80,6 +80,7 @@ function _menu_overview_tree_form($tree) { ...@@ -80,6 +80,7 @@ function _menu_overview_tree_form($tree) {
); );
$form[$mlid]['weight'] = array( $form[$mlid]['weight'] = array(
'#type' => 'weight', '#type' => 'weight',
'#delta' => 50,
'#default_value' => isset($form_state[$mlid]['weight']) ? $form_state[$mlid]['weight'] : $item['weight'], '#default_value' => isset($form_state[$mlid]['weight']) ? $form_state[$mlid]['weight'] : $item['weight'],
); );
$form[$mlid]['mlid'] = array( $form[$mlid]['mlid'] = array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment