I have a dataTable
that brings the data of a specific month set in DAO.
I would like to create a field where I select the month and it updates the table with the selected month.
Do you have to use ajax?
I have a dataTable
that brings the data of a specific month set in DAO.
I would like to create a field where I select the month and it updates the table with the selected month.
Do you have to use ajax?
To select a month of a year, use the Calendar component. You'll have to skip the day, but it works.
If you look at documentation you will see that there is an attribute called update
that can be used to update another component when a date is selected and the dateSelect
event occurs.
Document Based Example:
<p:calendar value="#{calendarBean.date}">
<p:ajax event=”dateSelect” listener=”#{bean.handleDateSelect}” update=”<id da tabela ser atualizada>” />
</p:calendar>
The handleDateSelect()
method can perform some necessary logic, but the important thing is that the method that generates the values of dataTable
reads the value of calendarBean.date
and extracts the month and year to update the table.