logo
Tags down

shadow

Downloading file during p:ajax rowSelect event in p:dataTable


By : user6096239
Date : September 15 2020, 05:00 PM
I wish this helpful for you You cannot download files with JSF/PrimeFaces Ajax. Make it a non-Ajax request instead.
Replace ajax listener in by a GET request in oncomplete something like:
code :
<p:ajax event="rowSelect" oncomplete="window.location='#{request.contextPath}/download/#{doc.id}'"/>
@WebServlet("/download/*")
public class Download extends HttpServlet {

    @Inject
    private DocumentService service;

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Document document = service.find(Long.valueOf(request.getPathInfo().substring(1)));
        response.setContentType(getServletContext().getMimeType(document.getFileName()));
        response.setContentLength(document.getContent().length);
        response.setHeader("Content-Disposition", "attachment;filename=\"" + URLEncoder.encode(document.getFileName(), "UTF-8") + "\"");
        response.getOutputStream().write(document.getContent());
    }

}


Share : facebook icon twitter icon

RowSelect event p:dataTable


By : majunior2012
Date : March 29 2020, 07:55 AM
hope this fix your issue As you are using dataTable with checkbox based row selection then you should replace:
code :
<p:ajax event="rowSelect"
<p:ajax event="rowUnselect"
<p:ajax event="rowSelectCheckbox"
<p:ajax event="rowUnselectCheckbox"

Primefaces Datatable RowSelect Event


By : Victor Manuel Hernnd
Date : March 29 2020, 07:55 AM
this one helps. try to send your datatable id in process of your ajax selection event like this:
code :
<p:ajax event="rowSelect" listener="#{resendEmailController.changeClient}" update="_accountTableForm_accountTable" process="clientTable" />

lazy datatable's rowselect event object is always null


By : bhavya sharma
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I'm trying to use the p:datatable to list a previously search result and then select a row to get displayed on a show dialog (as shown in showcase, http://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml). But SelectEvent.getObject() of ajax event "rowSelect" returns always null and current row is never selected. , your problem is this methode return null
code :
 @Override
    public Projet getRowData(String rowKey) {
        for(Projet projet : datasource) {
            if(projet.getIdprojet().equals(rowKey))
                return projet;
        }

        return null;
    }

p:dataTable p:ajax rowSelect rowUnselect listeners not invoked


By : Cezary Kowalski
Date : March 29 2020, 07:55 AM
hop of those help? I have this code in my view, but I can't invoke listener method when selecting any row. Each event points to a method that only prints a text in the console so I make sure it works, but it doesn't. I'm wondering if I'm missing something? , Adding
code :
<p:commandLink action="#{employeeController.selectEmployee(employee)}">
    <h:outputText value="#{employee.fullName}" />
</p:commandLink>

Can't get ajax rowSelect event to fire on PrimeFaces DataTable


By : Eleanore.Z
Date : March 29 2020, 07:55 AM
To fix the issue you can do you must add : selection="#{forumManagedBean.selectedPost}"
inside your the setter you can display the selected object:
shadow
Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk