magento2 – check all check boxes with just one click

I have one check box on the top of the page.
scenario: I want to check all checkboxes on each line by just clicking that top check box and uncheck all the checkboxes on each line by unchecking that top check box.

I have pagination so I want to work the above scenario only for the current page, not other pages.