SAPUI5를 처음 사용했습니다. 두 개의 컨트롤러 participantList.controller.js와 Topic.controller.js가 있습니다. participantList.js에서 refreshData라는 함수를 정의했으며 Topic.Controller.js 함수를 호출하려고합니다. 전반적으로 participantList보기의 맨 위에 진행률 표시기가 설정되었습니다. 주제보기에서 주제를 선택하여 주제보기에서 참여자보기로 이동할 때마다 참여자보기에있는 진행 표시기를 다시 시작하려고합니다. 도와주세요! 여기SAPUI5에서 진행률 표시기 버튼을 다시 시작 하시겠습니까?
는 ParticipantList.controller.js에 대한 코드입니다
var reset;
var list;
sap.ui.define([
"fiveminuteapp/controller/BaseController",
"fiveminuteapp/controller/Topic.controller"
],
function(BaseController, participant) {
"use strict";
return BaseController.extend("fiveminuteapp.controller.participant.ParticipantList", {
onInit: function() {
var topicheader = this.byId("employeeListPage");
topicheader.setTitle(topic);
this.listfunction();
this.testFunction();
},
refreshData: function() {
clearInterval(reset);
lTime.setText("5:00");
setInterval(reset);
},
testFunction: function() {
var setMinutes = 5;
var originalTime = setMinutes * 60;
var time = originalTime;
var lTime = this.byId("labelTimeLeft");
var progress = this.byId("progressIndicator");
reset = setInterval(function() {
var minutes;
var seconds;
if (time > -1) {
minutes = Math.floor(time/60);
seconds = time % 60;
time = time - 1;
if (minutes < 10 && seconds < 10) {
lTime.setText("0" + minutes + ":" + "0" + seconds);
} else if (minutes < 10) {
lTime.setText("0" + minutes + ":" + seconds);
} else if (seconds < 10) {
lTime.setText(minutes + ":" + "0" + seconds);
}
progress.setPercentValue((time/originalTime) * 100);
} else {
clearInterval(reset);
lTime.setText("5:00");
setInterval(reset);
if(lTime.getText() === "00:00"){
$.ajax({
type: "post",
data:{username: username},
url:"/fiveminuteapp/AddPoints"
})
}
}
}, 1000);
},
listfunction: function(){
var test = this.getView().byId("participantList");
setInterval(function(){
var aData = $.ajax({
type: "get",
data:{topic : topic},
contentType : "application/json",
url:"/fiveminuteapp/RetrieveName",
dataType: "json",
async:false,
}).responseJSON;
var oModel = new sap.ui.model.json.JSONModel(aData);
test.setModel(oModel, 'listmodel')
},5000)
}
});
});
여기 Topic.Controller.js에 대한 코드입니다
sap.ui.define([
"fiveminuteapp/controller/BaseController",
"fiveminuteapp/controller/participant/ParticipantList.controller"
], function(BaseController, participant) {
"use strict";
return BaseController.extend("fiveminuteapp.controller.Topic", {
onNavToParticipant: function(oEvent) {
var otime = window.originalTime;
var oItem = oEvent.getSource();
var oContext = oItem.getBindingContext("topics");
var topicSelected = oContext.getProperty("TopicChoices");
topic = topicSelected;
$.ajax({
type: "post",
data:{username: username, topic : topic},
url:"/fiveminuteapp/InsertTopic"
})
this.getRouter().navTo("participantList");
var time = participant.refreshData();
//sap.ui.controller("ParticipantList.controller.js").refreshData();
}
});
});