I want to load data to datatable when commandButton pressed in primefaces. When page load first, the datatable must be empty but after clicked the commandButton, the datatable must be loaded! How can I do. I’m newbie at the primefaces.
I want to load data to datatable when commandButton pressed in primefaces. When page
Share
From what you described in your question, here is a sample (This is just a working sample of what @Manuel described). Since the List on the backing bean is empty, at initial render, the datatable will be empty. When you click the commandbutton, it will fire the doPopulateList() method. This method will then populate the list. Finally, the update attribute will cause the datatable to reload the list from the backing bean. This time the List will be populated with 4 records.
DataTableSample backing bean: