• Resolved gmw0113

    (@gmw0113)


    Greetings-

    I’m trying to link to a pre sorted view of the table.

    For example, the first Category I have is “advocacy” and I’d like to be able to load the page with that view present without the users having to select it from the list.

    I haven’t found a method within the plugin to do this, so I spent some time trying to get it to work via jQuery. I’m basically using jQuery to set the selected option to Advocacy once the page has loaded. This works, but it doesn’t actually sort the table since I’m guessing there’s some Ajax being done here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter gmw0113

    (@gmw0113)

    I got it working by using setting the value of the option to advocacy, and then running a .change() function, but I’m wondering if there is a more elegant way.

    Thread Starter gmw0113

    (@gmw0113)

    Here’s what I’m doing, it works but it’s not super elegant.

    I’m grabbing a value from the Url, in this case website.com#advocacy.

    Then I set advocacy as the option value, then I run a change function after. This basically does an auto select of the advocacy option right after load, so it does flash the original sort. But at least it mostly works.


    <script type=”text/javascript”>
    jQuery(window).bind(“load”, function () {
    var selector = ‘select[name=”ptp_filter_library_category”]’;
    var hash = window.location.hash.substr(1);
    var optionHash = ‘ option[value=”‘ + hash + ‘”]’;
    var combined = jQuery(selector + optionHash);

    if (combined.length > 0){
    //console.log(‘exists’);
    jQuery(selector).val(hash);
    combined.change();
    }
    });
    </script>`

    Hi,

    Sorry for the delay replying to you.

    Is your question regarding this free plugin or our “premium” plugin Posts Table Pro? I assume it must be Posts Table Pro as the filter you’re referring to isn’t available in the free plugin.

    There isn’t a way to filter the table automatically on load I’m afraid. The way you’re currently approaching it might be the best option. There are options to filter the table by search term and you can display a table for a certain category or categories, but I don’t think that will achieve what you’re trying to do here.

    If you have any follow up questions on this, please could submit this via our Support Center.

    Thanks very much for your understanding.

    Regards,
    Andy

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Linking to specific sort?’ is closed to new replies.