-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
- v2.8.0-rc.1
- v2.8.0-rc.0
- v2.7.3
- v2.7.2
- v2.7.1
- v2.7.0
- v2.7.0-rc.2
- v2.7.0-rc.1
- v2.7.0-rc.0
- v2.6.3
- v2.6.2
- v2.6.2-rc.0
- v2.6.1
- v2.6.0
- v2.6.0-rc.5
- v2.6.0-rc.4
- v2.6.0-rc.3
- v2.6.0-rc.2
- v2.6.0-rc.1
- v2.6.0-rc.0
- v2.5.2
- v2.5.1
- v2.5.0
- v2.5.0-rc.3
- v2.5.0-rc.2
- v2.5.0-rc.1
- v2.5.0-rc.0
- v2.4.1-rc.0
- v2.4.0
- v2.4.0-rc.4
- v2.4.0-rc.3
- v2.4.0-rc.2
- v2.4.0-rc.1
- v2.4.0-rc.0
- v2.3.1-rc.0
- v2.3.0
- v2.3.0-rc.3
- v2.3.0-rc.2
- v2.3.0-rc.1
- v2.3.0-rc.0
- v2.2.0
- v2.2.0-rc.3
- v2.2.0-rc.2
- v2.2.0-rc.1
- v2.2.0-rc.0
- v2.1.2
- v2.1.1
- v2.1.0
- v2.1.0-rc.3
- v2.1.0-rc.2
- v2.1.0-rc.1
- v2.1.0-rc.0
- v2.0.1
- v2.0.0
- v2.0.0-rc.6
- v2.0.0-rc.5
- v2.0.0-rc.4
- v2.0.0-rc.3
- v2.0.0-rc.2
- v2.0.0-rc.1
- v2.0.0-rc.0
- v1.24.16
- v1.24.15
- v1.24.14
- v1.24.13
- v1.24.12
- v1.24.11
- v1.24.10
- v1.24.9
- v1.24.8
- v1.24.7
- v1.24.6
- v1.24.5
- v1.24.4
- v1.24.3
- v1.24.2
- v1.24.1
- v1.24.0
- v1.24.0-rc.4
- v1.24.0-rc.3
- v1.24.0-rc.2
- v1.24.0-rc.1
- v1.24.0-rc.0
- v1.23.3
- v1.23.2
- v1.23.1
- v1.23.1-rc.0
- v1.23.0
- v1.23.0-rc.5
- v1.23.0-rc.4
- v1.23.0-rc.3
- v1.23.0-rc.2
- v1.23.0-rc.1
- v1.23.0-rc.0
- v1.22.1-rc.0
- v1.22.0
- v1.22.0-rc.3
- v1.22.0-rc.2
- v1.22.0-rc.1
- v1.22.0-rc.0
- v1.21.2
- v1.21.1
- v1.21.0
- v1.21.0-rc.5
- v1.21.0-rc.4
- v1.21.0-rc.3
- v1.21.0-rc.2
- v1.21.0-rc.1
- v1.21.0-rc.0
- v1.20.1
- v1.20.0
- v1.20.0-rc.3
- v1.20.0-rc.2
- v1.20.0-rc.1
- v1.20.0-rc.0
- v1.19.1
- v1.19.0
- v1.19.0-rc.3
- v1.19.0-rc.2
- v1.19.0-rc.1
- v1.19.0-rc.0
- v1.18.1-rc.0
- v1.18.0
- v1.18.0-rc.2
- v1.18.0-rc.1
- v1.18.0-rc.0
- v1.17.4
- v1.17.3
- v1.17.2
- v1.17.1
- v1.17.0
- v1.17.0-rc.2
- v1.17.0-rc.1
- v1.17.0-rc.0
- v1.16.0
- v1.16.0-rc.4
- v1.16.0-rc.3
- v1.16.0-rc.2
- v1.16.0-rc.1
- v1.16.0-rc.0
- v1.15.1
- v1.15.0
- v1.15.0-rc.2
- v1.15.0-rc.1
- v1.15.0-rc.0
- v1.14.7
- v1.14.6
- v1.14.5
- v1.14.4
- v1.14.3
- v1.14.2
- v1.14.1
- v1.14.0
- v1.14.0-rc.2
- v1.14.0-rc.1
- v1.14.0-rc.0
- v1.13.3
- v1.13.2
- v1.13.1
- v1.13.0
- v1.13.0-rc.5
- v1.13.0-rc.4
- v1.13.0-rc.3
- v1.13.0-rc.2
- v1.13.0-rc.1
- v1.13.0-rc.0
- v1.12.2
- v1.12.1
- v1.12.0
- v1.12.0-rc.3
- v1.12.0-rc.2
- v1.12.0-rc.1
- v1.12.0-rc.0
- v1.11.3
- v1.11.2
- v1.11.1
- v1.11.0
- v1.11.0-rc.4
- v1.11.0-rc.3
- v1.11.0-rc.2
- v1.11.0-rc.1
- v1.11.0-rc.0
- v1.10.7
- v1.10.6
- v1.10.5
- v1.10.4
- v1.10.4-rc.0
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.0
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.0
- v1.5.0
- v0.0.0-dd8065714
- v0.0.0-7b49a7ff1
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,6 +183,14 @@ const metadata = { | |
filters: { type: Array }, | ||
}, | ||
}, | ||
|
||
/** | ||
* Fired before the component is opened. <b>This event does not bubble.</b> | ||
* | ||
* @public | ||
* @event sap.ui.webcomponents.fiori.ViewSettingsDialog#before-open | ||
*/ | ||
"before-open": {}, | ||
}, | ||
}; | ||
|
||
|
@@ -488,6 +496,7 @@ class ViewSettingsDialog extends UI5Element { | |
this._restoreSettings(this._confirmedSettings); | ||
} | ||
|
||
this.fireEvent("before-open", {}, true, false); | ||
this._dialog.show(true); | ||
|
||
this._dialog.querySelector("[ui5-list]").focusFirstItem(); | ||
|
@@ -667,6 +676,61 @@ class ViewSettingsDialog extends UI5Element { | |
// Invalidate | ||
this._currentSettings = JSON.parse(JSON.stringify(this._currentSettings)); | ||
} | ||
|
||
/** | ||
* Sets a JavaScript object, as settings to the ui5-view-settings-dialog. | ||
* This method can be used after the dialog is initially open, as the dialog need to set its initial settings. | ||
* The <code>ui5-view-settings-dialog</code> throws an event called "before-open", this can be used as trigger point. | ||
* The object should have the following format: | ||
* <code>{ | ||
* { "sortOrder" : "Ascending", "sortBy" : "Name", "filters" : [{"Filter 1": ["Some filter 1", "Some filter 2"]}, {"Filter 2": ["Some filter 4"]}]} | ||
* }</code> | ||
* @param {string} settings A value to be set as predefined settings. | ||
* @public | ||
*/ | ||
setConfirmedSettings(settings) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
tsanislavgatev
Author
Contributor
|
||
if (settings && this._dialog && !this._dialog.isOpen()) { | ||
const tempSettings = JSON.parse(JSON.stringify(this._confirmedSettings)); | ||
if (settings.sortOrder) { | ||
for (let i = 0; i < tempSettings.sortOrder.length; i++) { | ||
if (tempSettings.sortOrder[i].text === settings.sortOrder) { | ||
tempSettings.sortOrder[i].selected = true; | ||
} else { | ||
tempSettings.sortOrder[i].selected = false; | ||
} | ||
} | ||
} | ||
|
||
if (settings.sortBy) { | ||
for (let i = 0; i < tempSettings.sortBy.length; i++) { | ||
if (tempSettings.sortBy[i].text === settings.sortBy) { | ||
tempSettings.sortBy[i].selected = true; | ||
} else { | ||
tempSettings.sortBy[i].selected = false; | ||
} | ||
} | ||
} | ||
|
||
if (settings.filters) { | ||
const inputFilters = {}; | ||
for (let i = 0; i < settings.filters.length; i++) { | ||
inputFilters[Object.keys(settings.filters[i])[0]] = settings.filters[i][Object.keys(settings.filters[i])[0]]; | ||
} | ||
|
||
for (let i = 0; i < tempSettings.filters.length; i++) { | ||
for (let j = 0; j < tempSettings.filters[i].filterOptions.length; j++) { | ||
if (inputFilters[tempSettings.filters[i].text] && inputFilters[tempSettings.filters[i].text].indexOf(tempSettings.filters[i].filterOptions[j].text) > -1) { | ||
tempSettings.filters[i].filterOptions[j].selected = true; | ||
} else { | ||
tempSettings.filters[i].filterOptions[j].selected = false; | ||
} | ||
} | ||
} | ||
} | ||
|
||
this._confirmedSettings = JSON.parse(JSON.stringify(tempSettings)); | ||
} | ||
} | ||
} | ||
|
||
ViewSettingsDialog.define(); | ||
|
Did you also explore the option to expose a property from type Object.
We had similar request for the FlexibleColumnLayout by SFSF to provide custom layout configuration and we introduced the sap-restricted
Perhaps similar approach would also work for the ViewSettingsDialog, but there might facts that I am not aware of. Is it easier to sync the settings via the method?
As this is not yet released, it's worth double check on the API: