• Resolved vasilescu_anton

    (@vasilescu_anton)


    I’m trying to pull the data out of a table using:
    $table = TablePress::$model_table->load( $table_id, true, true );

    The return contains both visible and hidden rows. How could you filter that data? Are there any other options to the load function that I am missing?

    Thank you!

    https://ww.wp.xz.cn/plugins/tablepress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    The code that you posted is a low-level API function that does always return the full table data. To only retrieve visible data, you’d have to apply the code from the _prepare_render_data method of the class-render.php file.
    An alternative could be to hook into TablePress at the tablepress_table_render_data filter hook inside that function, to only retrieve/edit the visible rows.

    Regards,
    Tobias

    I am having the same issue. I have some javascript that needs the full table data except hidden rows. I still need a hidden column though. Any chance you could show me what to change here to make that happen?

    <script  type='text/javascript'>
    <?php
    $table = TablePress::$controller->model_table->load('Master');
    $js_array = json_encode($table[data]);
    echo "var _tableArray = ". $js_array . ";\n";
    ?>
    </script>
    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.
    Also, sorry for the long wait for a reply. As a I was on a long vacation without internet access the last couple weeks, I could not reply earlier.

    That PHP code will print the full table. The information about the visibility is stored in $table['visibility'] so that you will need to take that into account.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘How to load table data without hidden rows?’ is closed to new replies.