In my application we are using primefaces 6.0, here we are having one data table. To export that table values we are using primefaces data exporter.
In that table am having one column value has hyperlink, on click of the hyperlink we will display some data in model panel.
Now what is my issue is , at the time of export, i want to export the content what i am showing in the model panel instead of hyperlink. How can i achieve this?
We can achieve this by CSS styles, i know the data to export, That is in my current object so i have added in output label and applied style as display none. when i export, the display none output label data exported.
<p:column>
<f:facet name="header">
Header
</f:facet>
<p:commandLink styleClass="linkStyle" action="#{controller.opendialog(tc.optTagInfo)}">
<i class="fa fa-info-circle" aria-hidden="true"></i>
<h:outputLabel value="#{tc.optTagInfo}" style="display:none;"/>
</p:commandLink>
</p:column>
Related
I'm using a web application with Prime Faces.
In my datatable, in which a column is an image, I've the pagination. So I never load too many rows.
For each row I've the button "delete row". Here the code
<p:dataTable id="dataTableUploadedImages" var="singleRow">
...
...
<p:column headerText="#{msg['azioni']}" width="70">
<div align="center">
<p:commandButton icon="ui-icon-trash"
title="delete Row"
ajax="true"
action="#{myController.deleteRow(singleRow.id)}"
update="dataTableUploadedImages">
</p:commandButton>
</div>
</p:column>
</p:dataTable>
After clicking over the button, the application refresh the entire table instead of simply remove the single row.
In this page, refreshing all the rows is expensive (because a column contains an image) and slow down the application.
Is it possible to remove a row without reloading the entire table?
I have a dataTable with a list of employees.
One column of the dataTable is the names of the employees.
I want to have an inputText inside the header of the column which the user can use to filter the employees by their names, e.g. when the user writes "smi" in the inputText, the dataTable should only show the employees with the name starting with "smi" like Smith. The table data should update while the user is writing into the inputText, that is why I am using ajax here.
This is my column:
<h:column>
<f:facet name="header">Name
<h:form>
<h:inputText id="suchString" class="suchString"
value="#{mitarbeiteransicht.suchString}">
<f:ajax event="keyup" execute="suchString" render="ma-tabelle" />
</h:inputText>
</h:form>
</f:facet>
#{ma.bezeichnung}
</h:column>
ma-tabelle is my dataTable.
Everytime the table is rendered, the inputText inside the header is losing the focus and the user needs to click it again.
Is there a way around this? Is it possible to exclude the table headers when rerendering?
I have datatable with multiple checkbox selection (PF 3.3.1). I've defined column:
<p:column selectionMode="multiple"/>
I would like add some text or icon to header and I tried with headerText column attribute and with facet:
<f:facet name="header">
<h:outputText value="Header text" />
</f:facet>
But it doesn't work.
It is possible to modify header of checkbox selection column?
In case you want that feature badly and don't mind to use jquery, You could do something like
I tested it on primefaces shocase and it works (run these command at the console)
$("<span class='someClass'>Hellow</span>").insertAfter($('#form\\:multiCars thead tr:eq(2) th').find('.ui-chkbox-box'))
note that #form\\:multiCars should be changed with your table id
and tr:eq(2) refers to the third row in the table , cause in showcase the row with the headers is third
to change the width of that selection column you can use
$($('#form\\:multiCars thead tr:eq(2) th')[0]).css('width',100)
I'm aware of the fact that its waaaay ugly , but it works :)
Also you will have to run this script after each ajax rendering of the table
is it possible to preselect a cell in the Primefaces DataTable component? How do I do that? Tried it already with a Primefaces Cell object with a Getter, but this is not called by my data table :-(.
I need this because I have to restore the selection of the cell done a request before, if validation tells me, that a required field in the form was not filled.
This is my xhtml code snippet:
<p:dataTable id="select-start-pos" var="item"
selectionMode="singlecell"
value="#{frankingController.startposItems}"
selection="#{frankingController.selectedCell}"
styleClass="startPosGrid">
<p:column id="startposcol1">
<h:outputText value=""/>
</p:column>
<p:column id="startposcol2" rendered="#{frankingController.startposColumns > 1}">
<h:outputText value=""/>
</p:column>
</p:dataTable>
Thank you for your help!
Mike
No and 3.x doesn't have cell selection feature
You can use Sheet control instead of Datatable, it has row selection feature.
http://www.primefaces.org/showcase-labs/ui/sheet.jsf
I am looking for a way to implement a expand functionality to the rows of a Richfaces DataTable. The user would click a "+" link located in the first column (of each row) of the Datatable and the row would "expand" (meaning new text would be shown between the current row and the next).
I have that working, the only problem is that all the information in the expanded view is displayed in the first column section of that row. What I am trying to do is to show the "expanded" text in the whole row (as if the "expanded" text row is not divided by the columns).
Any suggestions? I'm a bit new at jsf/richfaces, so any sample code would be appreciated.
You can do this with the breakBefore attribute on the rich:column component. There is an example of its use on the RF demo page.
It would work for you if you had the last column define the breakBefore attribute. An example:
<rich:dataTable id="mytbl" value="#{mybean.mydata}" var="row">
<rich:column>
<a4j:commandLink reRender="mytbl">
<h:graphicImage value="#{row.toggleImage}"></h:graphicImage>
<a4j:actionparam name="shown" value="#{not row.expand}" assignTo="#{row.expand}"/>
</a4j:commandLink>
</rich:column>
<rich:column>
<f:facet name="header">col 2</f:facet>
<h:outputText value="#{row.col2}"/>
</rich:column>
<rich:column breakBefore="true">
spans all the other columns
</rich:column>
</rich:dataTable>
One way for this is you can use the JQuery feature.
Demo link http://jsfiddle.net/BU28E/1/ .
One extra overhead here is you need to check how the rich:dataTable renders as Html and provide the DOM model for jQuery. It is bit tricky to have such feature in richfaces and it needs some complex workarounds.