
scout.form.fields.wizard.WizardProgressFieldLayout.js Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2014-2015 BSI Business Systems Integration AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* BSI Business Systems Integration AG - initial API and implementation
******************************************************************************/
scout.WizardProgressFieldLayout = function(formField) {
scout.WizardProgressFieldLayout.parent.call(this, formField);
};
scout.inherits(scout.WizardProgressFieldLayout, scout.FormFieldLayout);
scout.WizardProgressFieldLayout.prototype.layout = function($container) {
scout.WizardProgressFieldLayout.parent.prototype.layout.call(this, $container);
// Remember old scroll position, because setting the body width might change it
var oldScrollLeft = this.formField.$field.scrollLeft();
// Explicitly set width of body to scrollWidth because container is scrollable. Otherwise,
// the body would have the wrong size because it has "overflow: hidden" set.
var $body = this.formField.$wizardStepsBody;
$body.width('auto'); // reset previously set width to ensure 'scrollWidth' returns the preferred size
var bodyWidth = $body[0].scrollWidth;
$body.width(bodyWidth);
// Ensure scrolling position did not change because of the width change (prevents flickering effect)
this.formField.$field.scrollLeft(oldScrollLeft);
// But also ensure the current step is visible
this.formField.scrollToActiveStep();
};
© 2015 - 2025 Weber Informatics LLC | Privacy Policy