2015-10-15 32 views
0

我想顯示其在兩種模式中使用的文本區域:哪個JSF組件在非編輯模式下顯示文本區域?

  • 的變形模式,使用對:編輯
  • 的可視化模式,其中僅文本區域是可見的。

哪個組件將是這個可視化模式的最佳選擇?我曾嘗試過:

  • p:editor:我不希望工具欄可見。看來它不可能隱藏它。
  • p:outputTextarea:由p:editor生成的html標籤在textarea中可見
  • h:outputText:渲染與p:editor有點不同,最重要的是,由於沒有垂直滾動條,文本溢出其容器。

我也嘗試用p:outputTextarea編輯和可視化模式,但我會在p:editor中使用其他工具。

有什麼想法?

<p:panel id="panelDG"> 
     <p:dataGrid id="pdatagrid1" layout="grid" value="#{ib.bloc.groups}" var="group" columns="#{ib.bloc.groupsSize}" rowIndexVar="status"> 
      <!-- other components --> 
       <p:panel styleClass="panel-textarea"> 
        <s:account> 
         <p:editor id="editor1" value="#{ib.textArea1}" rendered="#{status == 0}" maxlength="4000" controls="bold italic underline strikethrough bullets outdent indent alignleft center alignright justify undo redo" /> 
         <p:editor id="editor2" value="#{ib.textArea2}" rendered="#{status == 1}" maxlength="4000" controls="bold italic underline strikethrough bullets outdent indent alignleft center alignright justify undo redo" /> 
         <p:editor id="editor3" value="#{ib.textArea3}" rendered="#{status == 2}" maxlength="4000" controls="bold italic underline strikethrough bullets outdent indent alignleft center alignright justify undo redo" /> 
         <h:panelGrid > 
           <p:commandButton value="Save" action="#{ib.modifyGroupText(group)}" icon="ui-icon-disk" /> 
         </h:panelGrid> 
        </s:account> 
        <s:guest> 
          <h:outputText value="#{group.textArea}" escape="false"></h:outputText> 
        </s:guest> 
      </p:panel> 
     </p:dataGrid> 
</p:panel 

.panel-textarea{ 
height: 500px; 
} 
+0

*「渲染是從P的一點點不同:編輯和高於一切,因爲有沒有垂直滾動條,文本溢出它的容器「*只需扔入一些CSS來對齊它? – BalusC

+0

你的意思是在panel-textarea類或其他類中選擇一個更大的高度值?我不想要很大的價值。此外,我希望網頁能夠做出反應。在移動屏幕上,高度應該更大。 「 – ballidanse

+0

_」p:編輯器:我不想讓工具欄變得可見,似乎無法隱藏它。「_:你嘗試了什麼? **容易**隱藏與css – Kukeltje

回答

0

如果你想隱藏的<p:editor>工具欄,因爲用戶沒有修改權限,你可以簡單地使用CSS。

的facelet

<p:editor styleClass="#{!login.editAccess ? 'hideToolbar' : ''}" disabled="#{!login.editAccess}" ... /> 

CSS

.hideToolbar .ui-editor-toolbar { 
    display: none; 
} 
+1

爲什麼不改進原來的答案?這個答案也不好...只要隱藏工具欄不會使其不可編輯...您應該使用'p:editor'的'disabled'屬性(也可以在註釋中讀取; - )) – Kukeltje

+0

你說得對。我已刪除以前的帖子。 –

0

哦,我還沒有看到的.ui編輯器 - 工具欄類!

否則,使用h當以避免文字溢出:的outputText:

.h-outputText{ 
display:block !important; 
overflow-y: auto !important; 
height: 400px !important; 
} 

感謝所有答案

相關問題