Copiado do samples SAPUI5 library com modificações.
Controller file
- Alterei a função onDialogSel
- Adicionei no if o ID do dialog no arquivo fragment e no nome do fragment o path do arquivo.
onDialogSel: function(oEvent){
var oButton = oEvent.getSource(),
oView = this.getView();
if (!this.byId("mySelectDialog")) {
this._pDialog = Fragment.load({
id: oView.getId(),
name: "nspbapi.pbapix.controller.Dialog",
controller: this
}).then(function (oDialog){
oDialog.setModel(oView.getModel());
return oDialog;
});
}
this._pDialog.then(function(oDialog){
this._configDialog(oButton, oDialog);
oDialog.open();
}.bind(this));
},
_configDialog: function (oButton, oDialog) {
// Multi-select if required
var bMultiSelect = !!oButton.data("multi");
oDialog.setMultiSelect(bMultiSelect);
var sCustomConfirmButtonText = oButton.data("confirmButtonText");
oDialog.setConfirmButtonText(sCustomConfirmButtonText);
// Remember selections if required
var bRemember = !!oButton.data("remember");
oDialog.setRememberSelections(bRemember);
//add Clear button if needed
var bShowClearButton = !!oButton.data("showClearButton");
oDialog.setShowClearButton(bShowClearButton);
// Set growing property
var bGrowing = oButton.data("growing");
oDialog.setGrowing(bGrowing == "true");
// Set growing threshold
var sGrowingThreshold = oButton.data("threshold");
if (sGrowingThreshold) {
oDialog.setGrowingThreshold(parseInt(sGrowingThreshold));
}
// Set draggable property
var bDraggable = !!oButton.data("draggable");
oDialog.setDraggable(bDraggable);
// Set draggable property
var bResizable = !!oButton.data("resizable");
oDialog.setResizable(bResizable);
// Set style classes
var sResponsiveStyleClasses = "sapUiResponsivePadding--header sapUiResponsivePadding--subHeader sapUiResponsivePadding--content sapUiResponsivePadding--footer";
var bResponsivePadding = !!oButton.data("responsivePadding");
oDialog.toggleStyleClass(sResponsiveStyleClasses, bResponsivePadding);
// clear the old search filter
oDialog.getBinding("items").filter([]);
// toggle compact style
syncStyleClass("sapUiSizeCompact", this.getView(), oDialog);
},
onSearch: function (oEvent) {
var sValue = oEvent.getParameter("value");
var oFilter = new Filter("Name", FilterOperator.Contains, sValue);
var oBinding = oEvent.getParameter("itemsBinding");
oBinding.filter([oFilter]);
},
onDialogClose: function (oEvent) {
var aContexts = oEvent.getParameter("selectedContexts");
if (aContexts && aContexts.length) {
MessageToast.show("You have chosen " + aContexts.map(function (oContext) { return oContext.getObject().Name; }).join(", "));
} else {
MessageToast.show("No new item was selected.");
}
oEvent.getSource().getBinding("items").filter([]);
},
- Fragment file.
- Visão da arvóre na SEGW - visão da árvore no VS code
- Output
Nenhum comentário:
Postar um comentário