<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SAPUI 5 Auto refresh in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477050#M4674331</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
			"sap/ui/core/mvc/Controller"
			
		], function (Controller) {
			"use strict";

			return Controller.extend("DurchstichSYS.DurchstichSYS.controller.Durchstich", {

					onBeforeRendering: function () {

						setInterval(function () {

                             this.location.reload(true);
							// sap.ui.getCore().byId("Durchstich").getModel("").refresh(true);

							}, 10000);

}
					});
			});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 Dec 2021 09:01:28 GMT</pubDate>
    <dc:creator>former_member779347</dc:creator>
    <dc:date>2021-12-13T09:01:28Z</dc:date>
    <item>
      <title>SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaq-p/12477039</link>
      <description>&lt;P&gt;Hi all, &lt;/P&gt;
  &lt;P&gt;I want to auto refresh my UI5 Project. Here is my code from an other question in a controller. sap.ui.define([&lt;/P&gt;
  &lt;P&gt;"sap/ui/core/mvc/Controller"&lt;/P&gt;
  &lt;P&gt;], function (Controller) {&lt;/P&gt;
  &lt;P&gt; "use strict";&lt;/P&gt;
  &lt;P&gt; return Controller.extend("DurchstichSYS.DurchstichSYS.controller.refresh", {&lt;/P&gt;
  &lt;P&gt; [window.]setInterval(functionToRefreshModel,1000); //Trigger this function every 1000 milliseconds&lt;/P&gt;
  &lt;P&gt; } &lt;/P&gt;
  &lt;P&gt; });&lt;/P&gt;
  &lt;P&gt;});&lt;/P&gt;
  &lt;P&gt;I get a error like "parsing error unexpected token". Please help me.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 09:51:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaq-p/12477039</guid>
      <dc:creator>former_member779347</dc:creator>
      <dc:date>2021-12-06T09:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477040#M4674321</link>
      <description>&lt;P&gt;Yes, this message is correct as you cannot enter arbitrary JavaScript code within an object. Have a look &lt;A href="https://sapui5.hana.ondemand.com/#/topic/50579ddf2c934ce789e056cfffe9efa9"&gt;here&lt;/A&gt; to see what the expected syntax of a UI5 controller is. You probably want to call setInterval in the onInit method of the controller. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
    "sap/ui/core/mvc/Controller"
], function (Controller) {
    "use strict";
    return Controller.extend("sap.ui.demo.walkthrough.controller.App", {
        onInit: function () {
            setInterval(functionToRefreshModel, 1000); //Trigger this function every 1000 milliseconds
        }
    });
});



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also should mention that using setInterval to refresh a model smells a bit like an anti pattern.&lt;/P&gt;&lt;P&gt;PS: Please make use of the code formatter next time you ask a question. This makes it easier to read and answer your question &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 11:07:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477040#M4674321</guid>
      <dc:creator>mariusobert</dc:creator>
      <dc:date>2021-12-07T11:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477041#M4674322</link>
      <description>&lt;P&gt;Ok, thanks for your advice, but do you know of a better way to display live data in the view that automatically updates? Could you show me please.&lt;/P&gt;&lt;P&gt;Jetzt bekomme ich die Fehlermeldung, dass functionToRefreshModel nicht definiert ist, das ist wahr, wie kann ich das tun? &lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 11:46:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477041#M4674322</guid>
      <dc:creator>former_member779347</dc:creator>
      <dc:date>2021-12-07T11:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477042#M4674323</link>
      <description>&lt;P&gt;Let's stay in English here so that non-German speakers can follow the discussion as well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This approach is ok if you do it carefully. But you need to make sure the interval is only initialized once and to clear it when the controller is &lt;A href="https://blogs.sap.com/2018/11/12/sapui5-controller-lifecycle-methods-explained/"&gt;destroyed&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;And yes, you need to implement that function as well. It's up to you where you define it but I needs to be in scope of the onInit function. This is a pure JS question and not related to the UI5 framework.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 12:38:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477042#M4674323</guid>
      <dc:creator>mariusobert</dc:creator>
      <dc:date>2021-12-07T12:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477043#M4674324</link>
      <description>&lt;P&gt;Thank you for the answer! I get again the error with the unexcpected token.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
	"sap/ui/core/mvc/Controller"
], function (Controller) {
	"use strict";

	return Controller.extend("DurchstichSYS.DurchstichSYS.controller.Durchstich", {
		onInit: function () {
			
            setInterval( functionToRefreshModel , 1000 ); // Diese Funktion alle 1000 Millisekunden auslösen
          
          functionToRefreshModel{
			DurchstichSYS.DurchstichSYS.view.Durchstich.reload();
		}
		}
		
          }); 

});	&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Dec 2021 15:36:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477043#M4674324</guid>
      <dc:creator>former_member779347</dc:creator>
      <dc:date>2021-12-07T15:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477044#M4674325</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;mariusobert&lt;/SPAN&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 13:59:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477044#M4674325</guid>
      <dc:creator>former_member779347</dc:creator>
      <dc:date>2021-12-10T13:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477045#M4674326</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;function functionToRefreshModel(){
			DurchstichSYS.DurchstichSYS.view.Durchstich.reload();
		}&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Dec 2021 15:59:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477045#M4674326</guid>
      <dc:creator>junwu</dc:creator>
      <dc:date>2021-12-10T15:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477046#M4674327</link>
      <description>&lt;P&gt;I still get a Parsing error: unexpected token fuction [ESLINT: () ]&lt;/P&gt;&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;jun.wu5&lt;/SPAN&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
	"sap/ui/core/mvc/Controller"
], function (Controller) {
	"use strict";

	return Controller.extend("DurchstichSYS.DurchstichSYS.controller.Durchstich", {
		onInit: function () { 
			// falsches event
			[window].setInterval(functionToRefreshModel , 1000 ); // Diese Funktion alle 1000 Millisekunden auslösen
		}
          function functionToRefreshModel(){
			DurchstichSYS.DurchstichSYS.view.Durchstich.reload();
		}
		
		}
		
          }); 

});&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Dec 2021 17:40:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477046#M4674327</guid>
      <dc:creator>former_member779347</dc:creator>
      <dc:date>2021-12-10T17:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477047#M4674328</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
	"sap/ui/core/mvc/Controller"
], function (Controller) {
	"use strict";

	return Controller.extend("DurchstichSYS.DurchstichSYS.controller.Durchstich", {
		onInit: function () { &lt;BR /&gt;function functionToRefreshModel(){
			DurchstichSYS.DurchstichSYS.view.Durchstich.reload();
		}
			// falsches event
			[window].setInterval(functionToRefreshModel , 1000 ); // Diese Funktion alle 1000 Millisekunden auslösen
		}
          
		
		}
		
          }); 

});&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Dec 2021 19:52:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477047#M4674328</guid>
      <dc:creator>junwu</dc:creator>
      <dc:date>2021-12-10T19:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477048#M4674329</link>
      <description>&lt;P&gt;you'd better learn some basic javascript, what you are asking has nothing to do with ui5.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 19:53:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477048#M4674329</guid>
      <dc:creator>junwu</dc:creator>
      <dc:date>2021-12-10T19:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477049#M4674330</link>
      <description>&lt;P&gt;I agree with Jun. I don't mean this in a rude way (and I'm sure Jun doesn't either). But I don't think you'll be able to solve that problem by asking these questions. I recommend doing a JS training on Pluralsight, Lynda.com or any of the other learning platforms.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 07:45:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477049#M4674330</guid>
      <dc:creator>mariusobert</dc:creator>
      <dc:date>2021-12-13T07:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAPUI 5 Auto refresh</title>
      <link>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477050#M4674331</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;sap.ui.define([
			"sap/ui/core/mvc/Controller"
			
		], function (Controller) {
			"use strict";

			return Controller.extend("DurchstichSYS.DurchstichSYS.controller.Durchstich", {

					onBeforeRendering: function () {

						setInterval(function () {

                             this.location.reload(true);
							// sap.ui.getCore().byId("Durchstich").getModel("").refresh(true);

							}, 10000);

}
					});
			});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Dec 2021 09:01:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sapui-5-auto-refresh/qaa-p/12477050#M4674331</guid>
      <dc:creator>former_member779347</dc:creator>
      <dc:date>2021-12-13T09:01:28Z</dc:date>
    </item>
  </channel>
</rss>

