• Resolved bugsbunnny

    (@bugsbunnny)


    Hello. I want to do this

    echo '<tbody>';
                foreach ( $table['body'] as $tr ) {
                    echo '<tr>';
                        foreach ( $tr as $td ) {
                            echo '<td data-th="'. $th['c'] .'">';
                                echo $td['c'];
                            echo '</td>';
                        }
                    echo '</tr>';
                }
            echo '</tbody>';

    but in data-th insert only last value (on screenshot)
    https://gyazo.com/ce63648e82da602feee88faf4a5d2b0c

    Can you help me fixed this problem?

    • This topic was modified 4 years, 12 months ago by bugsbunnny.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Johann Heyne

    (@jonua)

    This should work…

    echo '<tbody>';
        foreach ( $table['body'] as $tr ) {
            echo '<tr>';
                foreach ( $tr as $column_index => $td ) {
                    echo '<td data-th="'. $table['header'][ $column_index ]['c'] .'">';
                        echo $td['c'];
                    echo '</td>';
                }
            echo '</tr>';
        }
    echo '</tbody>';

    Cheers,
    Johann

    Thread Starter bugsbunnny

    (@bugsbunnny)

    Thank you! This work!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom data-th in td’ is closed to new replies.