How to change only checkboxes visible from a datatable?

Asked

Viewed 344 times

1

Problem situation, suppose we have a datatable on the first faces with the following features:

  • The first column instead of the title has a checkbox with the label all.
  • All rows in this first column also have a checkbox (and this checkbox is related to an attribute of the class being used to populate the table. For example, if they are cars, in addition to the class having the name and value of the car, for example, would also have a field selection, which would indicate that that car is selected or not, coupled to a proprieade of the class being used to popular the table.)
  • All columns except the first one have a filter contains to filter results.
  • The table may contain several pages.

What would be the easiest and most effective way to make that by pressing the checkbox all, only visible checkboxes (i.e., those of the current page, already applying the filters or not) are selected (and therefore also their selection property in the corresponding bean)?

1 answer

2


As you put the primfaces tag, I assume you are using it. In the very demo of the first faces you have what you are asking.

Look for the table that is using checkbox and see.

Primefaces Datatable

  • Wow. Very cool. I hadn’t found this showcase. Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.