ZK 框架中的 Combobox onCreate 事件

huangapple 未分类评论64阅读模式
标题翻译

ZK framework onCreate event on Combobox

问题

  1. <?xml version="1.0" encoding="utf-8" standalone="yes"?>
  2. <form id="topComponent" style="String:border: 0px;">
  3. <Style src="/forms/TegsoftTelecom/webchat/ccchat.css" />
  4. <script src="/forms/TegsoftTelecom/webchat/20200122_ccchatmessage.js" />
  5. <Vbox id="webChatUserLoginVbox" align="center" style="String:background:#fff;border: 0px;" width="100%" height="93%" visible="boolean:false">
  6. <window id="userLoginWindow" height="300px" width="350px" style="String:text-align:left" contentStyle="String:border: 0px;overflow: hidden;" border="none">
  7. <div>
  8. <Grid width="100%" height="100%" style="String:border:0px solid #ddd;border-radius:3px;background:white">
  9. <Columns sizable="boolean:false" menupopup="auto">
  10. <Column width="100%" />
  11. </Columns>
  12. <Rows>
  13. <Row>
  14. <TextField id="webchatLoginFirstName" placeholder="${Firstname}" class="labelParameterText" width="100%" height="40px" maxlength="int:50" tooltiptext="${Surname}" />
  15. </Row>
  16. <!-- Other Rows and Controls -->
  17. <Row>
  18. <ComboBox id="webchatLoginSkill" placeholder="${Subject}" width="100%" bindingProperty="SelectedIndex" listDataSourceName="TBLCCCHATSKILLS" listDataMember="NAME" listBindingProperty="SKILLID" class="labelParameterValueText" height="40px" maxlength="int:50">
  19. <eventListener eventName="onCreate" methodName="com.tegsoft.cc.webchat.WebchatUIEventHandler.initSkillBox"/>
  20. </ComboBox>
  21. </Row>
  22. <!-- Other Rows and Controls -->
  23. </Rows>
  24. </Grid>
  25. </div>
  26. </window>
  27. </Vbox>
  28. <!-- Other sections and controls -->
  29. </form>
英文翻译

I am relatively new to ZK framework and need to solve a problem. I have to hide some of the combobox items, and in order to do that i have to access those items and set their visibility by calling setVisible(false).

When I call a method at the end of the file I only get one combobox item which is empty, but in fact there is at least 3 combobox items when the page fully loads. So I have to find something like onload javascript event(I think it is onCreate for ZK) and call my java method(initSkillBox) inside that event. The code below does not raise any errors but it simply does nothing, no event is triggered.

Can anybody tell me what i am doing wrong?

Thanks.

  1. &lt;form id=&quot;topComponent&quot; style=&quot;String:border: 0px;&quot;&gt;
  2. &lt;Style src=&quot;/forms/TegsoftTelecom/webchat/ccchat.css&quot; /&gt;
  3. &lt;script src=&quot;/forms/TegsoftTelecom/webchat/20200122_ccchatmessage.js&quot; /&gt;
  4. &lt;Vbox id=&quot;webChatUserLoginVbox&quot; align=&quot;center&quot; style=&quot;String:background:#fff;border: 0px;&quot; width=&quot;100%&quot; height=&quot;93%&quot; visible=&quot;boolean:false&quot;&gt;
  5. &lt;window id=&quot;userLoginWindow&quot; height=&quot;300px&quot; width=&quot;350px&quot; style=&quot;String:text-align:left&quot; contentStyle=&quot;String:border: 0px;overflow: hidden;&quot; border=&quot;none&quot;&gt;
  6. &lt;div&gt;
  7. &lt;Grid width=&quot;100%&quot; height=&quot;100%&quot; style=&quot;String:border:0px solid #ddd;border-radius:3px;background:white&quot;&gt;
  8. &lt;Columns sizable=&quot;boolean:false&quot; menupopup=&quot;auto&quot;&gt;
  9. &lt;Column width=&quot;100%&quot; /&gt;
  10. &lt;/Columns&gt;
  11. &lt;Rows&gt;
  12. &lt;Row&gt;
  13. &lt;TextField id=&quot;webchatLoginFirstName&quot; placeholder=&quot;${Firstname}&quot; class=&quot;labelParameterText&quot; width=&quot;100%&quot; height=&quot;40px&quot; maxlength=&quot;int:50&quot; tooltiptext=&quot;${Surname}&quot; /&gt;
  14. &lt;/Row&gt;
  15. &lt;Row&gt;
  16. &lt;TextField id=&quot;webchatLoginLastName&quot; placeholder=&quot;${Surname}&quot; class=&quot;labelParameterText&quot; width=&quot;100%&quot; height=&quot;40px&quot; maxlength=&quot;int:50&quot; tooltiptext=&quot;${Surname}&quot; /&gt;
  17. &lt;/Row&gt;
  18. &lt;Row&gt;
  19. &lt;TextField id=&quot;webchatLoginEmail&quot; placeholder=&quot;${Email}&quot; class=&quot;labelParameterText&quot; width=&quot;100%&quot; height=&quot;40px&quot; maxlength=&quot;int:150&quot; tooltiptext=&quot;${Email}&quot; /&gt;
  20. &lt;/Row&gt;
  21. &lt;Row&gt;
  22. &lt;TextField id=&quot;webchatLoginPhone&quot; placeholder=&quot;${Phone}&quot; class=&quot;labelParameterText&quot; width=&quot;100%&quot; height=&quot;40px&quot; maxlength=&quot;int:50&quot; tooltiptext=&quot;${Phone}&quot; /&gt;
  23. &lt;/Row&gt;
  24. &lt;Row&gt;
  25. &lt;/Row&gt;
  26. &lt;Row&gt;
  27. &lt;ComboBox id=&quot;webchatLoginSkill&quot; placeholder=&quot;${Subject}&quot; width=&quot;100%&quot; bindingProperty=&quot;SelectedIndex&quot; listDataSourceName=&quot;TBLCCCHATSKILLS&quot;
  28. listDataMember=&quot;NAME&quot; listBindingProperty=&quot;SKILLID&quot; class=&quot;labelParameterValueText&quot; height=&quot;40px&quot; maxlength=&quot;int:50&quot;&gt;
  29. &lt;eventListener eventName=&quot;onCreate&quot; methodName=&quot;com.tegsoft.cc.webchat.WebchatUIEventHandler.initSkillBox&quot;/&gt;
  30. &lt;/ComboBox&gt;
  31. &lt;/Row&gt;
  32. &lt;Row&gt;
  33. &lt;Button height=&quot;35px&quot; style=&quot;String:border: 2px solid #ff7d00;border-radius:3px;background:#ff7d00;color:white;font-size:15px;font-family: &#39;Roboto&#39;, sans-serif;&quot; width=&quot;100%&quot; label=&quot;${StartWebChat}&quot;&gt;
  34. &lt;eventListener eventName=&quot;onClick&quot; methodName=&quot;com.tegsoft.cc.webchat.WebchatUIEventHandler.startWebchat&quot; /&gt;
  35. &lt;/Button&gt;
  36. &lt;/Row&gt;
  37. &lt;Row&gt;
  38. &lt;HtmlNativeComponent tag=&quot;div&quot; id=&quot;loading&quot;&gt;
  39. &lt;method name=&quot;setDynamicProperty&quot; parameter0=&quot;id&quot; parameter1=&quot;loading&quot; /&gt;
  40. &lt;method name=&quot;setDynamicProperty&quot; parameter0=&quot;styleClass&quot; parameter1=&quot;loading&quot; /&gt;
  41. &lt;/HtmlNativeComponent&gt;
  42. &lt;/Row&gt;
  43. &lt;/Rows&gt;
  44. &lt;/Grid&gt;
  45. &lt;/div&gt;
  46. &lt;/window&gt;
  47. &lt;/Vbox&gt;
  48. &lt;Vbox id=&quot;webChatVbox&quot; align=&quot;center&quot; style=&quot;String:background:#fff;border: 0px;&quot; width=&quot;100%&quot; height=&quot;93%&quot; visible=&quot;boolean:false&quot;&gt;
  49. &lt;window id=&quot;chatWindow&quot; height=&quot;400px&quot; width=&quot;350px&quot; style=&quot;String:text-align:left&quot; contentStyle=&quot;String:border: 0px;overflow: hidden;&quot; border=&quot;none&quot;&gt;
  50. &lt;div class=&quot;container clearfix&quot; visible=&quot;boolean:true&quot;&gt;
  51. &lt;div class=&quot;chat&quot; height=&quot;400px&quot;&gt;
  52. &lt;div class=&quot;chat-history&quot; height=&quot;370px&quot;&gt;
  53. &lt;html id=&quot;chatHtml&quot; /&gt;
  54. &lt;/div&gt;
  55. &lt;div height=&quot;20px&quot;&gt;
  56. &lt;div id=&quot;agentWritingStatus&quot; class=&quot;typing&quot; visible=&quot;boolean:false&quot;&gt;
  57. &lt;Label value=&quot;${Typing}&quot; style=&quot;String:font-style: italic;padding-left: 2px;padding-right:2px;color:#FF7D00;font-family: &#39;Open Sans&#39;, Helvetica, Arial, sans-serif;&quot; /&gt;
  58. &lt;div class=&quot;ball ball-1&quot;&gt;
  59. &lt;/div&gt;
  60. &lt;div class=&quot;ball ball-2&quot;&gt;
  61. &lt;/div&gt;
  62. &lt;div class=&quot;ball ball-3&quot;&gt;
  63. &lt;/div&gt;
  64. &lt;div class=&quot;ball ball-4&quot;&gt;
  65. &lt;/div&gt;
  66. &lt;/div&gt;
  67. &lt;/div&gt;
  68. &lt;/div&gt;
  69. &lt;Hbox width=&quot;100%&quot; style=&quot;String:background:#fff;border: 0px;&quot;&gt;
  70. &lt;div class=&quot;send-message-area&quot;&gt;
  71. &lt;TextField id=&quot;sendMSG&quot; width=&quot;280px&quot; placeholder=&quot;${MessageText}&quot; height=&quot;35px&quot; style=&quot;String:width: 100%;row:3;border: none;padding: 2px 5px 2px 5px;font: 16px/20px &#39;Roboto&#39;, sans-serif; margin-bottom: 1 px ; border-radius: 5 px ; resize: none ;&quot;&gt;
  72. &lt;eventListener eventName=&quot;onOK&quot; methodName=&quot;com.tegsoft.cc.webchat.WebchatUIEventHandler.sendMessageContact&quot; /&gt;
  73. &lt;eventListener eventName=&quot;onChange&quot; methodName=&quot;com.tegsoft.cc.webchat.WebchatUIEventHandler.updateContactWritingStatus&quot; /&gt;
  74. &lt;eventListener eventName=&quot;onChanging&quot; methodName=&quot;com.tegsoft.cc.webchat.WebchatUIEventHandler.updateContactWritingStatus&quot; /&gt;
  75. &lt;eventListener eventName=&quot;onFocus&quot; methodName=&quot;com.tegsoft.cc.webchat.WebchatUIEventHandler.updateContactWritingStatus&quot; /&gt;
  76. &lt;/TextField&gt;
  77. &lt;Image src=&quot;P{TEGSOFT_THEME}/tegsoft-chat-send.png&quot; id=&quot;P{RECEIVERUID}_chatImage&quot; hover=&quot;P{TEGSOFT_THEME}/tegsoft-chat-send-hover.png&quot; tooltiptext=&quot;${Send}&quot; style=&quot;String:cursor:pointer;position: absolute;background-color: #fff;width: 50px;height: 35px;bottom: 3px;right: 3px;border: none;&quot;&gt;
  78. &lt;eventListener eventName=&quot;onClick&quot; methodName=&quot;com.tegsoft.cc.webchat.WebchatUIEventHandler.sendMessageContact&quot; /&gt;
  79. &lt;/Image&gt;
  80. &lt;/div&gt;
  81. &lt;/Hbox&gt;
  82. &lt;/div&gt;
  83. &lt;/window&gt;
  84. &lt;/Vbox&gt;
  85. &lt;Iframe id=&quot;desttypeChatIframe&quot; width=&quot;100%&quot; height=&quot;93%&quot; visible=&quot;boolean:false&quot; /&gt;
  86. &lt;Iframe id=&quot;waitChatIframe&quot; width=&quot;100%&quot; height=&quot;93%&quot; visible=&quot;boolean:false&quot; /&gt;
  87. &lt;Iframe id=&quot;endChatIframe&quot; width=&quot;100%&quot; height=&quot;93%&quot; visible=&quot;boolean:false&quot; /&gt;
  88. &lt;Vbox id=&quot;webChatPoweredByTegsoft&quot; align=&quot;center&quot; pack=&quot;center&quot; style=&quot;String:background:#fff;border: 0px;&quot; width=&quot;100%&quot; height=&quot;7%&quot;&gt;
  89. &lt;window id=&quot;poweredByTegsoftWindow&quot; height=&quot;40px&quot; width=&quot;350px&quot; style=&quot;String:text-align:left&quot; contentStyle=&quot;String:border: 0px;overflow: hidden;&quot; border=&quot;none&quot;&gt;
  90. &lt;div&gt;
  91. &lt;Grid width=&quot;100%&quot; height=&quot;100%&quot; style=&quot;String:border:0px solid #ddd;border-radius:3px;background:white&quot;&gt;
  92. &lt;Columns sizable=&quot;boolean:false&quot; menupopup=&quot;auto&quot;&gt;
  93. &lt;Column width=&quot;60%&quot; /&gt;
  94. &lt;Column width=&quot;25%&quot; /&gt;
  95. &lt;Column width=&quot;15%&quot; /&gt;
  96. &lt;/Columns&gt;
  97. &lt;Rows&gt;
  98. &lt;Row&gt;
  99. &lt;div id=&quot;optionsBtn&quot; visible=&quot;boolean:false&quot;&gt;
  100. &lt;Button height=&quot;35px&quot; class=&quot;hiddenButtonClass&quot; style=&quot;String:border: 2px solid #ff7d00;border-radius:3px;background:#ff7d00;color:white;font-size:15px;font-family: &#39;Roboto&#39;, sans-serif;&quot; width=&quot;100%&quot; label=&quot;${chatEnd}&quot;&gt;
  101. &lt;eventListener eventName=&quot;onClick&quot; methodName=&quot;com.tegsoft.cc.webchat.WebchatUIEventHandler.exitChat&quot; /&gt;
  102. &lt;/Button&gt;
  103. &lt;/div&gt;
  104. &lt;TextField value=&quot;Powered by&quot; width=&quot;100%&quot; style=&quot;String:text-align:right;border:none;color:grey;font-size:12px;font-style: italic;font-family: &#39;Roboto&#39;, sans-serif;&quot; readonly=&quot;boolean:true&quot; /&gt;
  105. &lt;HtmlNativeComponent tag=&quot;img&quot;&gt;
  106. &lt;method name=&quot;setDynamicProperty&quot; parameter0=&quot;height&quot; parameter1=&quot;50px&quot; /&gt;
  107. &lt;method name=&quot;setDynamicProperty&quot; parameter0=&quot;width&quot; parameter1=&quot;50px&quot; /&gt;
  108. &lt;method name=&quot;setDynamicProperty&quot; parameter0=&quot;style&quot; parameter1=&quot;String:cursor:pointer&quot; /&gt;
  109. &lt;method name=&quot;setDynamicProperty&quot; parameter0=&quot;src&quot; parameter1=&quot;/Tobe/image/Tegsoft-hello-happy.png&quot; /&gt;
  110. &lt;method name=&quot;setDynamicProperty&quot; parameter0=&quot;onclick&quot; parameter1=&quot;openTegsoftUrl();&quot; /&gt;
  111. &lt;/HtmlNativeComponent&gt;
  112. &lt;/Row&gt;
  113. &lt;/Rows&gt;
  114. &lt;/Grid&gt;
  115. &lt;/div&gt;
  116. &lt;/window&gt;
  117. &lt;/Vbox&gt;
  118. &lt;method type=&quot;com.tegsoft.cc.webchat.WebchatUIEventHandler&quot; name=&quot;initChat&quot; /&gt;
  119. &lt;method type=&quot;com.tegsoft.cc.webchat.WebchatUIEventHandler&quot; name=&quot;initSkillBox&quot; /&gt;
  120. &lt;/form&gt; ```
  121. </details>

huangapple
  • 本文由 发表于 2020年1月30日 19:34:51
  • 转载请务必保留本文链接:https://java.coder-hub.com/59985132.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定