0

How to change Page Title Dynamically from java using MVVM [closed]

asked 2019-09-26 00:28:40 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

How to change Page Title Dynamically from java using MVVMimage description

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by Senthilchettyin
close date 2019-09-26 11:15:11

3 Answers

Sort by ยป oldest newest most voted
1

answered 2019-09-26 10:58:33 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2019-09-26 11:02:27 +0800

it's not wrong. In the end you are calling page.setTitle() you simply found a complicated way to do so.

Instead you can just use the features MVVM provides - to avoid this kind of long chain of method calls. (just as in my previous example)

  @AfterCompose
  public void afterCompose(@ContextParam(ContextType.PAGE) Page page) {
    page.setTitle("initial title");
  }

http://zkfiddle.org/sample/31tj128/3-mvvm-set-page-title

link publish delete flag offensive edit
0

answered 2019-09-26 09:28:18 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2019-09-26 09:29:36 +0800

I know this is not a pure MVVM since it requires direct access to the page object. But then this is most simple thing I could think of:

Simply call page.setTitle("updated title");

http://zkfiddle.org/sample/31tj128/1-mvvm-set-page-title

(you need to run this in a dedicated browser tab to see the title change http://temp.zkfiddle.org:1223/t862svt/31tj128/1/)

However this sounds too obvious and I assume you already tried that. In case you did: were there any difficulties on your side?

link publish delete flag offensive edit
0

answered 2019-09-26 09:49:23 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2623 3 8
http://emrpms.blogspot.in...

updated 2019-09-26 11:13:29 +0800

cor3000 gravatar image cor3000
6280 2 7

I saw the example. It is explicit i,e on button click. I want to load automatically. So i added the following line in afterCompose method and it works.

Executions.getCurrent().getDesktop().getFirstPage().setTitle("Homecare");

is this correct ?

link publish delete flag offensive edit

Question tools

Follow
1 follower

RSS

Stats

Asked: 2019-09-26 00:28:40 +0800

Seen: 14 times

Last updated: Sep 26 '19

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More