Purpose
Control the responsiveness of a DataTable programmatically. This filter allows you to enable or disable the responsive behavior of a DataTable based on specific conditions or settings.
Usage
add_filter( "wr_DataTable_responsive_filter", array( $this, "disable_responsiveness" ), 10, 2 );Parameters
- $is_responsive (bool): A boolean flag indicating whether the DataTable is responsive. Defaults to true.
- $datatable (DataTable): The DataTable object containing settings and data for the table.
Use Case
This functionality is useful when:
- You need to disable the responsive behavior for specific DataTables based on their settings or context.
- Certain tables require fixed layouts or non-responsive behavior for better usability.
Implementation Example
The following example disables responsiveness for a DataTable with settings that include the identifier equipment_datatable:
add_filter( "wr_DataTable_responsive_filter", array( $this, "disable_responsiveness" ), 10, 2 );
 
public function disable_responsiveness( bool $is_responsive, DataTable $datatable ): bool {  
    $settings = $datatable->get_settings();  
    if ( str_contains( $settings['options'], "equipment_datatable" ) ) {  
       return false;  
    }  
  
    return $is_responsive;  
}