0

edit tab text

asked 2019-07-08 21:12:20 +0800

cahesm gravatar image cahesm
151

Is there a way to edit tab text on the fly?

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2019-07-09 10:13:05 +0800

cor3000 gravatar image cor3000
4596 2 7
ZK Team

I assume you are referring to the ZK tabbox/tab-component and not a browser "tab" or a golden layout "tab" or any other kind of "tab" one can implement. Also please specify what you mean by "on the fly" and also state your ZK version. Ideally provide a zul example illustrating your case.

link publish delete flag offensive edit

Comments

I was wondering if there is a way to double click the tab and edit it's label. Im working on an application where it's possible to create a form by adding fields ands tabs dinamically, so it would be great if I could change the tab label when performing double clicking.

cahesm ( 2019-07-09 20:09:19 +0800 )edit

you still missed to explain which kinds of "tabs" you are talking about, so I assume it's ZK's tab component (org.zkoss.zul.Tab)

cor3000 ( 2019-07-10 11:17:40 +0800 )edit
0

answered 2019-07-10 11:12:49 +0800

cor3000 gravatar image cor3000
4596 2 7
ZK Team

updated 2019-07-10 11:18:27 +0800

here a example showing 2 ways how this can be achieved

<zk>
  <tabbox>
    <tabs>
      <tab>
        <caption>
          <label id="display"
                 value="DoubleClick to edit, ENTER to save" 
                 onDoubleClick="self.setVisible(false); edit.setValue(self.getValue()); edit.setVisible(true);"
                 />
          <textbox id="edit" visible="false"
                   onOK="self.setVisible(false); display.setValue(self.getValue()); display.setVisible(true);"/>
        </caption>
      </tab>
      <tab>
        <caption>
          <textbox value="Inline Edit" inplace="true"/>
        </caption>
      </tab>
    </tabs>
  </tabbox>
</zk>

http://zkfiddle.org/sample/1i5v9eb/1-editable-tab-labels

either showing/hiding a textbox, or using a<textbox inplace="true"/>

Of course you can do the same dynamically from java code, instead of inline event listeners, used in this example ONLY for simpler demonstration purposes.

link publish delete flag offensive edit

Comments

Thanks, it will help me a lot.

cahesm ( 2019-07-10 19:09:40 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2019-07-08 21:12:20 +0800

Seen: 8 times

Last updated: Jul 10

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