basic_crud_community's People
basic_crud_community's Issues
oList values not passing to SetBoundMasterList in ListSelector.js
Hello uxkjaer,
I tried the same clean code approach for my CRUD UI5 application but the Promise is not getting fulfilled as your code does.
Below is the code I have written in my app. Could you please have a look and let me know what I'm missing.
_**Master.controller.js
sap.ui.define([
'sap/master/detail/controller/BaseController',
'sap/ui/Device'
], function (Controller, Device) {
"use strict";
return Controller.extend("sap.master.detail.controller.Master", {
onInit: function() {
var oList = this.byId("list");
this._oList = oList;
this._oListSelector = this.getOwnerComponent().oListSelector;
oList.attachEventOnce("UpdateFinished", function(){
});
this.getView().addEventDelegate({
onBeforeFirstShow: function(){
this._oListSelector.setBoundMasterList(oList);
}.bind(this)
});
// this._oListSelector.setBoundMasterList(oList);
this.getRouter().getRoute("master").attachPatternMatched(this._onMasterMatched, this);
},
_onMasterMatched: function(){
this._oListSelector.oWhenListLoadingIsDone.then({
function(mParams){
if(mParams.list.getMode === "NONE"){
return;
}
var sObjectPath = mParams.firstListItem.getBindingContext().getProperty("Pernr");
}
});
},**_
_**ListSelector.js
sap.ui.define(['sap/ui/base/Object'],
function (BaseObject) {
return BaseObject.extend("sap.master.detail.controller.ListSelector", {
constructor: function(){
this._oWhenListHasBeenSet = new Promise(function(fnResolveListHasBeenSet){
this._fnResolveListHasBeenSet = fnResolveListHasBeenSet;
}.bind(this));
this.oWhenListLoadingIsDone = new Promise(function(fnResolve, fnReject){
this._oWhenListHasBeenSet
.then(function(oList) {
oList.getBinding("items").attachEventOnce("dataRecieved", {
function(oData){
if(!oData.getParameter("data")){
fnReject({
list: oList,
error: true
});
}
var oFirstListItem = oList.getItems()[0];
if(oFirstListItem){
fnResolve({
list: oList,
firstListItem: oFirstListItem
});
}else{
fnReject({
list: oList,
error: false
});
}
}
});
});
}.bind(this));
},
setBoundMasterList: function(oList){
this._oList = oList;
this._fnResolveListHasBeenSet(oList);
},
clearMasterListSelection: function(){
this._oWhenListHasBeenSet.then(function(){
this._oList.removeSelections(true);
}.bind(this));
},**_
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.