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

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    The best way for that should be to use a the tablepress_render_output filter hook. With that, you can use code like

    add_filter( 'tablepress_table_output', 'tp_add_wrapper', 10, 3 );
    function tp_add_wrapper( $output, $table, $render_options ) {
      $output = "<div class=\"tablepress-wrapper\">\n{$output}\n</div>";
      return $output;
    }

    e.g. in your theme’s functions.php or a small new plugin file. That way you don’t have to modify the TablePress plugin files, as you would lose those changes after a plugin update.

    Regards,
    Tobias

    Thread Starter radula

    (@radula)

    Sorry for asking again,I want to add wrapper just around the table, so that i can border the table.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ok, I might not be understanding what you mean then.
    This will add a wrapping <div> element around the table.
    Is that now what you want?

    Or do you only want a border around your table? Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Regards,
    Tobias

    Thread Starter radula

    (@radula)

    URL: https://cyberbel.com/
    I had inserted the code in functions.php, but it was wrapping ‘dataTables_wrapper’ container not just the table. Instead I want to wrap around the table, so that i can apply border around the table wrapper.

    Presently the code looks like:
    <div class=”tablepress-wrapper2″>

    <div id=”tablepress-devTools_wrapper” class=”dataTables_wrapper” role=”grid”><div id=”tablepress-devTools_length” class=”dataTables_length”><label>Show <select size=”1″ name=”tablepress-devTools_length” aria-controls=”tablepress-devTools”><option value=”10″ selected=”selected”>10</option><option value=”25″>25</option><option value=”50″>50</option><option value=”100″>100</option></select> entries</label></div><div class=”dataTables_filter” id=”tablepress-devTools_filter”><label>Search: <input type=”text” aria-controls=”tablepress-devTools”></label></div><table id=”tablepress-devTools”

    Instead I was expecting, tablepress-wrapper2 to wrap around table tag

    Thread Starter radula

    (@radula)

    I want to wrap the table so that I can apply border radius to the table.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for the detailed explanations! This won’t work like this, unfortunately. The dataTables_wrapper container is added on the fly by the DataTables JavaScript library, via JavaScript, and because of that, it will always be the direct wrapper for the <table> element.

    You would have to tell DataTables to add another wrapper for you, but for a rounded border, you should actually not need a wrapper.
    It should be enough to add some “Custom CSS” as described in this thread: https://www.ads-software.com/support/topic/can-tablepress-do-this?replies=9

    By the way: Many links/ressources on your site are being loaded from localhost instead of the real domain, which means that they will only load for you. You should fix that!

    Regards,
    Tobias

    Thread Starter radula

    (@radula)

    Thanks for the response. The link which you provided would work for me to apply border radius. Thanks for finding the ‘localhost’ link issue, I missed noticing them.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    Thanks for the snippet, Tobias

    As mentioned it only works with javascript enabled for the table

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    can you clarify? The code from my first reply does not need the JS library to be enabled.

    Regards,
    Tobias

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘adding wrapper around table in tablepress’ is closed to new replies.