Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for the suggestion.

    Unfortunately, I’m not really sure how this could be implemented in a good way, especially with the user interface…

    For now, it might be the best idea to use the wp_table_reloaded_cell_content filter hook. That gives you access to the current row and column numbers, so that you could check if your are in the desired column (likely the first one), and then return the row number as the cell content.

    Regards,
    Tobias

    Thread Starter Yakir Gottesman

    (@yakirgot)

    Can you show me what you mean? I don’t get it.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    I mean a small Plugin Extension (see https://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/extensions/ for an introduction), like this:

    add_filter( 'wp_table_reloaded_cell_content', 'wp_table_reloaded_first_column_auto_numbering', 10, 4 );
    function wp_table_reloaded_first_column_auto_numbering( $cell_content, $table_id, $row_number, $column_number ) {
    	if ( 123 != $table_id )
    		return $cell_content;
    	if ( 1 != $column_number )
    		return $cell_content;
    	if ( 1 == $row_number )
    		return $cell content;
    	// if we get here, we are in the table body, first column,
    	// so we print the row number, but -1, because of the header row
    	return ( $row_number - 1 );
    }

    The table ID needs to be changed of course, and if this is for more than one table, an in_array() check might be the easiest.
    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WP-Table Reloaded] New feature suggest: auto numbering’ is closed to new replies.