• Resolved derkmeyer

    (@derkmeyer)


    Hello Tobias,
    first of all thanks for this great work.

    I’m using the latest releases of wordpress and tablepress and I have searched for a solution but I didn’t suceed.

    What I need is a combination of the automatic filtering plugin and the shortcode filter from get parameter. Is that possible?

    In detail: I have a table with education courses. If I enter the training site (e.g. https://mysite.com/training) all courses shall be displayed. From other sites I want to filter the course list by a specific name. This will be passed by an URL parameter like https://mysite.com/training?course_filter=GSD

    The automatic filtering [table id=123 datatables_auto_filter=”word” /] is nice. But I need a way to pass i the value of the URL filter “course_filter”.

    Thanks in advance and many greetings,
    Derk

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

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    This should not be too difficult:
    In the tablepress-shortcode-filter-get-parameter.php file, please change the line

    $attributes['filter'] = $filter_term;
    

    to

    $attributes['datatables_auto_filter'] = $filter_term;
    

    Regards,
    Tobias

    Thread Starter derkmeyer

    (@derkmeyer)

    Hi Tobias,
    it works! Thank you very much für the quick answer.

    One more problem – I habe a special character in the course Name (a german ?).

    I have tried the following hyperlinks
    CATIA V5 GSD Fl?chen
    CATIA V5 GSD Fl?chen
    CATIA V5 GSD Fl?chen

    None of these works…. If I click on it the URL changes to
    https://srv-dsbiwp/desyscte/schulungstermine-catia-v5/?table_filter=CATIA%20V5%20GSD%20Fl%C3%A4chen

    In the Search Field appears “CATIA V5 GSD Flchen” and the table has no entries….

    If I edit the URL or the search field manually everything is fine.

    Do you have an idea what is going wrong with the special character in the hyperlink definition?

    Thanks,
    Derk

    Thread Starter derkmeyer

    (@derkmeyer)

    OK, the hyperlinks look very equal ??

    I have tried the german ? and the HTML Codes ä and ä

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    the reason for this is the excaping that the Extension is doing, for security.

    There are two places where you will have to make modifications: In tablepress-shortcode-filter-get-parameter.php, you will have to adjust

    $filter_term = preg_replace( '#[^a-z0-9 ]#i', '', $filter_term );
    

    and in tablepress-datatables-auto-filter.php you will have to adjust
    $auto_filter_word = preg_replace( '#[^0-9a-zA-Z\.% +-_]#', '', $js_options['datatables_auto_filter'] );

    It might be sufficient to add the umlaut characters there.

    Regards,
    Tobias

    Thread Starter derkmeyer

    (@derkmeyer)

    Great! It works!

    Thank you very much!

    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!

    Thread Starter derkmeyer

    (@derkmeyer)

    Hi Tobias,
    the same thing with a different extension (using a german “umlaut” ü):

    I try the row highlight extension:

    That’s the shortcode entry:
    [table id=15 hide_columns=”2,3,4,5,6,7,8,9,10″ hide_rows=”1″ row_highlight=”CATIA V5 PowerFeature für NC-Programmierer”/]

    It results in:
    <tr class=”row-7 row-highlight-catia-v5-powerfeature-f%c3%bcr-nc-programmierer”>
    <td class=”column-1″>CATIA V5 PowerFeature für NC-Programmierer</td>
    </tr>

    My CSS definition is:
    .tablepress-id-15 .row-highlight-catia-v5-powerfeature-für-nc-programmierer {
    background-color: #00529e !important;
    color: #ffffff !important;
    }
    and the highlighting does not work…..

    So, what is the right way to handle the special characters (e.g. ü)?

    Thanks in advance and many greetings,
    Derk

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Derk,

    that’s an interesting question… I think, using Umlauts in CSS classes is not allowed, which indicates that the sanitization function that is used here is not sufficient.

    Now, do you actually need to use the full cell content for the Shortcode parameter here? Would CATIA V5 PowerFeature maybe work? Then, you could just use that shorter version. Or do you also need the row_highlight_full_cell_match parameter?

    Regards,
    Tobias

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Automatic Filtering by url parameter’ is closed to new replies.