wpdatatables_extend_column_js_definition

Contents

Description

This filter is used to extend or modify the JavaScript definition object for a column. It allows you to add custom properties or adjust the default behavior of the column’s JSON representation used in the table rendering process.

Usage

add_filter( 'wpdatatables_extend_column_js_definition', 'extend_column_js_definition', 10, 2 );

Parameters

  • $colJsDefinition object
    The default JavaScript definition object for the column.
  • $columnInstance object
    The column instance being processed, providing access to its properties and methods.

Examples

// Callback function for the wpdatatables_extend_column_js_definition filter hook
function extend_column_js_definition($colJsDefinition, $columnInstance) {
    // Add a custom property for a specific column
    if ($columnInstance->getOriginalHeader() === 'custom_header') {
        $colJsDefinition->customProperty = 'custom_value';
    }

    return $colJsDefinition;
}

add_filter( 'wpdatatables_extend_column_js_definition', 'extend_column_js_definition', 10, 2 );