How to select all checkboxes from all pages in jQuery datatable grid?

Normally jQuery datatable will display 10 records at a time. If we select using paging max it will show 100. If user needs to select all records form all pages. Below example I will show you how to select all records from all pages of jQuery datatable and same way if user unchecks select all checkbox it will uncheck checkboxes from all pages.