Forums de discussion

SennaJS and AngularJS or ReactJS

thumbnail
Severin Rohner, modifié il y a 7 années.

SennaJS and AngularJS or ReactJS

Junior Member Publications: 43 Date d'inscription: 28/01/14 Publications récentes
My PoC for a Angular 2 portlet (Tour of Heroes tutorial) and a React portlet (Product Table tutorial) work both after a page refresh. (Both portlets without routing)
If I click in the Liferay 7 anything that use the Liferay SPA (SennaJS), my portlet will be empty afterwards. It doesn't matter if I navigate to a other page and back or if I click to a document in the Document am Media view portlet on the same page.

How/where should I add the JavaScript Files to bootstrap the AngularJS app?
How/where should I add the jsx code to load the ReactJS?
<script type="text/babel" src="/o/reactpoc/ProductTable.jsx"></script>


Why is my portlet rendered again if I click something in a other portlet on the same page?

Thanks lot for your help or explanations about SennaJS in Liferay 7
thumbnail
Bruno Basto, modifié il y a 7 années.

RE: SennaJS and AngularJS or ReactJS

New Member Publications: 18 Date d'inscription: 13/05/10 Publications récentes
Hello Serverin,

The reason why your portlet is rendered again is because on every navigation we set the html of the body of the page again. Our SPA implementation is not updating only the changed portions just yet. This is on our radar for the lines of work for the future.

If you need your JavaScript files to be executed again after a navigation happens, you can do:

<script data-senna-track="temporary" type="text/javascript" src="/o/myapp/MyJavaScript.js"></script>


Notice the data-senna-track="temporary". It makes your JS file get executed on every navigation. For more info, check out the "Trackable resources" on the senna docs: http://sennajs.com/docs

As for the JSX file, the way you are including should be fine because I assume you only need the template to be parsed once.

Let me know if you have any more questions.

Thank you for reaching out.
thumbnail
Severin Rohner, modifié il y a 7 années.

RE: SennaJS and AngularJS or ReactJS

Junior Member Publications: 43 Date d'inscription: 28/01/14 Publications récentes
Hi Bruno
Thank you very much for your answer. I tried it quick without success. But I had not so much time in case of vacancies. I will try it next days again and let you know if it works.

Cheers Severin
Viktor Dzundza, modifié il y a 7 années.

RE: SennaJS and AngularJS or ReactJS

New Member Publications: 16 Date d'inscription: 16/09/16 Publications récentes
I've tried this one and it does not help. So js files are not executed in every transition
thumbnail
Severin Rohner, modifié il y a 7 années.

RE: SennaJS and AngularJS or ReactJS

Junior Member Publications: 43 Date d'inscription: 28/01/14 Publications récentes
With Liferay 7 GA3 it worked for me. I put the Angular files at the end of the html header.
Isabel Jason, modifié il y a 6 années.

RE: SennaJS and AngularJS or ReactJS

New Member Publications: 2 Date d'inscription: 04/08/17 Publications récentes
I am an enormous devotee of Liferay too. I have my dissatisfactions with the item as you do however by the day's end, I generally observe it to be superior to the choices. Furthermore, even with the work arounds and to such an extent that are required, I think that its quicker to expand on that whatever else (that I have utilized). I have a few remarks on your focuses.

1.Starting time is presently any longer than Liferay 6.2
2. Accompanying OSGI, each time you refresh your code, package is refreshed and restarted. Presently, arrangement time takes longer, improvement work as well.
3. Theming prescribes utilizing the new generator, every alteration performed on a CSS requires now recompilation and organization. Around 15 seconds to get every alteration accessible on the gateway.
4. It would seem that Liferay designers disregarded Windows clients and the greater part of the apparatuses are not advanced or even square (I recommend you take a stab at doing a topic on Windows and after 'swallow watch', execute the errand. The server keeps a bolt on records and you can't restart 'swallow watch' unless you restart your server or change your subject from the entry).
5. Have you taken a stab at altering a web content utilizing structures, a few fields are not modifiable (but rather ought to be) and the "spare" bar stays unmistakable on the highest point of the modular without adhering to primary concern.
6. Try not to attempt relocation when you have web content/structure with pictures in Liferay 6.2. Your pictures are moved yet the web content can't discover them any more.
7. Movement from Liferay 6.2 to Liferay 7 GA3 for an exceptionally basic/light site (simply content) took me 40 minutes to finish.