Okay
  Public Ticket #1679796
Determine if a table has data to display
Closed

Comments

  • jcleaveland started the conversation

    Hi, I am looking for a quick way to determine if there is data to display for a given table. 

    I want to use that information to either display the content (the shortcode) in the template for the page or display a message that no content exists with a link to go create some content.

    Thanks!

  •  471
    Isidora replied

    Hi jcleaveland,

    Thank you for your purchase.

    Sorry but I did not quite understand what are you trying to achieve. Can you please explain me more and send me some example/screenshot/screencast so I can give you my suggestion.

    Best regards.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  • jcleaveland replied

    Hi Milan,

    When I display a table on the front-end and it has no data to present, it shows an empty table with no content where the widget should be like Image 1.

    This is in contrast to what it displays when there is content and the filter widget is displayed correctly like Image 2.

    In order to prevent confusion and make it easier for users to get started creating content, I want to display a message and a button like Image 3 when there is no data to present in the table.

    I was thinking about grabbing the sql query from the content column of the wpdatatables table in the database and doing a quick query to see if there are any results before displaying the content of the page, but that seems pretty resource heavy. 

    I am curious if you have a hook or filter or helper function that will already do that for me so I can display the appropriate content on the page.

    Or perhaps there is an easier way that I am not thinking of?

    Thanks for your help!

  •  471
    Isidora replied

    Hi jcleaveland,

    Sorry for late response. 

    We are located in Serbia and our working time is from 10:00 to 17:00 CET. business days.

    You can take a look about wpdatatables_filter_rendered_table( $tableContent, $tableId )

    This filter is applied to the rendered table HTML.

    $content is the HTML of the table.

    $tableId is the table identifier from the database.


    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables