中的动画列。无论文本有多大,所有列中的文本都限制为一行
希望你们一切都好。我有 ap:dataTable,其中有这样的列
<p:column filterBy="#{Faq.faqCategoryName}"
headerText="Category"
filterMatchMode="contains">
<h:outputText value="#{Faq.faqCategoryName}"
style="color: #0d5b7f;" />
</p:column>
<p:column filterBy="#{Faq.question}"
headerText="Questions"
filterMatchMode="contains" >
<h:commandLink value="#{Faq.question}"
action="#{faq.viewFaq()}"
style="color: #0d5b7f;" >
<f:param name="id" value="#{Faq.faqId}" />
</h:commandLink>
</p:column>
<p:column filterBy="#{Faq.answer}"
headerText="Answers"
filterMatchMode="contains" >
<h:outputText value="#{Faq.answer}"
style="color: #0d5b7f;" />
</p:column>
<p:column headerText="Action" >
<h:commandLink action="#{faq.updateFaq}"
value="Update"
title="Update FAQ Category"
style="color: #0d5b7f;text-decoration: underline" >
<f:param name="id" value="#{Faq.faqId}" />
</h:commandLink>
<p:spacer width="3" />
<h:commandLink action="#{faq.deleteFaq(Faq)}"
value="Delete"
title="Delete FAQ Category"
style="color: #0d5b7f;text-decoration: underline"
onclick="if (! confirm('Are you sure, you want to delete the FAQ?') ) { return false;}; return true; ">
<f:param name="id" value="#{Faq.faqId}" />
</h:commandLink>
</p:column>
问题是问题和答案列可以尽可能大。现在发生的情况是,如果这些列中的文本很大,那么它会出现在同一列的下一行。我希望无论这些列中的文本有多长,文本都不会附加到下一行。
相反,我显示省略号,表明该列有更多文本,当您将鼠标悬停在该列上时,会出现一个显示整个文本的框。 我的意思是说所有列都应该只有一行。如果文本较大,则显示省略号,而不是附加到下一行的文本。 这可能吗?如果是的话我该怎么做?我需要在这里使用 jQuery 吗?
谢谢
Hope you all will be fine. I have a p:dataTable in which i have columns like this
<p:column filterBy="#{Faq.faqCategoryName}"
headerText="Category"
filterMatchMode="contains">
<h:outputText value="#{Faq.faqCategoryName}"
style="color: #0d5b7f;" />
</p:column>
<p:column filterBy="#{Faq.question}"
headerText="Questions"
filterMatchMode="contains" >
<h:commandLink value="#{Faq.question}"
action="#{faq.viewFaq()}"
style="color: #0d5b7f;" >
<f:param name="id" value="#{Faq.faqId}" />
</h:commandLink>
</p:column>
<p:column filterBy="#{Faq.answer}"
headerText="Answers"
filterMatchMode="contains" >
<h:outputText value="#{Faq.answer}"
style="color: #0d5b7f;" />
</p:column>
<p:column headerText="Action" >
<h:commandLink action="#{faq.updateFaq}"
value="Update"
title="Update FAQ Category"
style="color: #0d5b7f;text-decoration: underline" >
<f:param name="id" value="#{Faq.faqId}" />
</h:commandLink>
<p:spacer width="3" />
<h:commandLink action="#{faq.deleteFaq(Faq)}"
value="Delete"
title="Delete FAQ Category"
style="color: #0d5b7f;text-decoration: underline"
onclick="if (! confirm('Are you sure, you want to delete the FAQ?') ) { return false;}; return true; ">
<f:param name="id" value="#{Faq.faqId}" />
</h:commandLink>
</p:column>
The problem is Questions and Answers column can be as large as possioble. Now what is happening that if the text is large in these columns then it comes to next line in the same column. I want that no matter that how long the text is in these columns, the text never append to next line.
Instead i show ellipsess symbol that indicating that this column has more text and when you mouse hover the column then the box appear that will show the whole text.
I mean to say that all columns should be of one line only. If text is larget , then ellipses shown instead of text appending to next line.
Is this possible ? If yes then how can i do it? Do i need to use jQuery here?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一切皆有可能!
您可以使用这个简单的 JavaScript 解决方案: http://www.barelyfitz.com/projects/truncate/ (如果您不喜欢
onclick
事件,您可以实现onhover
事件)。您可以使用以下 JQuery 解决方案: http://henrik.nyh.se/2008/ 02/jquery-html-截断。
而且,因为您选择了 Primefaces,所以您可以使用工具提示组件。通过截断列值来组合 javascript 解决方案,并向工具提示提供完整的值(您也可以从服务器提供截断的值):
http://www.primefaces.org/showcase-labs/ui/tooltip.jsf
PS:当你说
希望你们都会好吧
,看来您正在宣布地震……这令人悲伤,而且是错误的!Anything is possible!
You could use this simple javascript solution: http://www.barelyfitz.com/projects/truncate/ (and if you don't like the
onclick
event, you could implement anonhover
event).You could use this JQuery solution: http://henrik.nyh.se/2008/02/jquery-html-truncate.
But also, 'cause you have chosen Primefaces, you could use the tooltip component. Combine the javascript solution by truncating the column value and provide the full value to the tooltip (also you could provide that truncated value from the server):
http://www.primefaces.org/showcase-labs/ui/tooltip.jsf
PS: When you say
Hope you all will be fine
, it looks like you're announcing an earthquake...it's sad and it's wrong!这是工作
工具提示使用您的标题属性,以显示工具提示上的文本显示。
谢谢
This is working
Tooltip uses your title attribute, to show text display on ToolTip.
Thanks