Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author samsk

    (@samsk)

    Yes you need to use raw JS attributes, see source code of my working example on https://dob.sk/aplikacie/financna-sprava/variabilny-symbol/rok-2017/.

    You have to play with sDOM attribute and maybe initComplete callback to customize how filter looks like. This is complicated topic, so consult Datatables manual and examples.

    Thread Starter buylov

    (@buylov)

    @samsk,
    thanks for the answer.
    I understand how to add a filter without your plugin (just in html page). But where to add the code in your plugin? Maybe you will provide an example, how to compile the page, how do you follow the link?

    Plugin Author samsk

    (@samsk)

    Simply add it within plugin code:

    
    [wp-datatable id="ID" fat="LEVEL"]
        paging: false,
        responsive: true,
        search: true,
    
        sDOM: "xxxx",
        initComplete: function....
    
        //.. and more - see https://datatables.net/reference/option for full reference
    [/wp-datatable]
    

    Content of wp-datatable shortcodes will be used as content for DataTable() init.

    But there is a catch, if the code within shortcode is too complicated, wordpress editor might corrupt it, because it is not well suited for such a thing. In that case, you’ll have to use this plugin only for provisioning of javascript – simply use only [wp-datatable] in the post/page, and the initialization of DataTables has to be done somewhere else, via really pure Javascript like:

    
    <script type="text/javascript">
    jQuery(document).ready(function () {
    var $dt = jQuery('#' + $DT_name).DataTable({
            "sDom": '<"H"lfr>t<"F"ip>',
            //....
    });
    </script>
    

    You might have to use another plugin for inclusion of that pure Javascript to accomplish this.

    If I use the shortcode [wpdatatable id = x] to call a table that I created, how could I call it with some filter parameter to show only the values that I create?
    I have 12 tables that I use on the web, but I want to use them in another part of the web with some filters and I do not want to have to create the same tables but with filters (I know this perfectly and in the 2.1 version have been solved the problems I had filtering).
    I’ve read about including the parameter in the URL, but I do not know how to do it with my tables if I’m calling from Visual Composer.
    Waiting for your news, I say goodbye.
    Atte.
    MAX

    Plugin Author samsk

    (@samsk)

    Hi, I don’t understand your question.
    Our shortcode is [wp-datatable], and Visual Composer is unknown to me.
    Please, include some examples.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add a filter?’ is closed to new replies.