Project

General

Profile

Create a 'Reset Form' button

NOTE : This change refers to Sitools2 - v2.4

The 'Reset Form' button is created beside the 'Search' one, and it invokes a generic resetToDefault() function for all the components of the form.

To enable it, the following lines of code should be added to

source:git_sitools_idoc|szcluster-db/workspace/client-user/js/components/forms/mainContainer.js@d45a7442#L143
source:git_sitools_idoc|szcluster-db/workspace/client-user/js/components/forms/projectForm.js@d45a7442#L236

this.resetFormButton = new Ext.Button({
    text : 'Reset Form',
    scope : this,
    iconCls : 'x-btn-reset',
    handler : function () {
        var containers = this.find("stype", 'sitoolsFormContainer');
        Ext.each(containers, function (container) {
                if(Ext.isFunction(container.resetToDefault)){
                container.resetToDefault();
                }
        }, this);
    }
});

Then, resetToDefault() is declared specifically for each component and added at the end of their JavaScript files:

source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/BooleanCheckBox.js@d45a7442#L81
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/CheckBox.js@d45a7442#L103
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/ConeSearch.js@d45a7442#L350
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/DateBetween.js@d45a7442#L234
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/ListBoxMultiple.js@d45a7442#L153
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/Listbox.js@d45a7442#L153
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/NumberBetween.js@d45a7442#L260
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/NumberFieldUser.js@d45a7442#L154
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/OneOrBetween.js@d45a7442#L220
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/PlanckType.js@d45a7442#L147
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/Radio.js@d45a7442#L118
source:git_sitools_idoc|szcluster-db/workspace/client-public/js/forms/components/textfield.js@d45a7442#L137

Finally, the icon and button style are declared in the CSS file:

source:git_sitools_idoc|szcluster-db/workspace/client-public/res/css/desktop.css@d45a7442#L1479

button.x-btn-reset{
  font-size: 1.2em;
  font-weight: normal;
  background-image: url("/sitools/common/res/images/icons/clean.png");
}