// $Id$ /** * Show the Save button when fields are swapped. * * This behavior is dependent on the tableDrag behavior, since it uses the * objects initialized in that behavior to update the row. */ Drupal.behaviors.cckFieldDrag = function(context) { var table = $('table#content-field-overview'); var tableDrag = Drupal.tableDrag['content-field-overview']; // Get the tableDrag object. var tableChanged = false; // Add a handler for when a row is swapped, mark table as changed. tableDrag.row.prototype.onSwap = function(swappedRow) { tableChanged = true; console.log('Fields swapped'); }; // Add a handler for when a row is dropped, show Save button. tableDrag.onDrop = function() { if (tableChanged) { $('#edit-submit').fadeIn('slow'); console.log('Save button shown'); } } };