Forum Replies Created

Viewing 15 replies - 1 through 15 (of 33 total)
  • Thread Starter akiikiwporg

    (@akiikiwporg)

    Hi,

    Thanks. The issue was resolved by changing “template_redirect” to “High” under Advanced Settings > Page Builders Compatibility.

    Screenshot

    Thread Starter akiikiwporg

    (@akiikiwporg)

    More info: Under the “Logs” tab I see “URL generated in MPG and some page or post slug is equal.” for all pages in my existing projects.

    In addition, I created a completely new project for troubleshooting. Same thing, “URL generated in MPG and some page or post slug is equal…”

    • This reply was modified 2 years, 8 months ago by akiikiwporg.
    • This reply was modified 2 years, 8 months ago by akiikiwporg.
    Thread Starter akiikiwporg

    (@akiikiwporg)

    I assume the “PHP Everywhere Upgrade” page is supposed to show the code snippets, but it does not – see screenshot here.

    Thread Starter akiikiwporg

    (@akiikiwporg)

    Great. I’ll try that.

    Is “tablpress_print_table” a typo?

    Thread Starter akiikiwporg

    (@akiikiwporg)

    Hi Tobias!

    I reached out to the developer of the MPG plugin, and they came up with this PHP-snippet, which solved the problem.

    $condition = MPG_CoreModel::mpg_shortcode_replacer('{{mpg_cvht_tag}}', '7');
    
    echo do_shortcode('[table id=43 filter="' . $condition . '" 
    responsive="collapse" /]');

    This snippet passes the filter term correctly to the TablePress table.
    The second argument, “7”, refers to the specific MPG project.

    Thread Starter akiikiwporg

    (@akiikiwporg)

    Hi.

    I manually inserted the filter term “c_coaching” in the PHP code.
    Like this:

    <?php
    $cvht_filter = "c_coaching";
    echo do_shortcode('[table id=43 filter="'.$cvht_filter .'" responsive="collapse" shortcode_debug=true /]');
    ?>

    The table is filtered correctly to the four relevant rows.

    Filter is:

    'filter' => 'c_coaching',

    And here is the rest of the debugging report:

    array (
      'id' => '43',
      'column_widths' => '',
      'alternating_row_colors' => false,
      'row_hover' => false,
      'table_head' => true,
      'table_foot' => false,
      'first_column_th' => false,
      'print_name' => false,
      'print_name_position' => 'above',
      'print_description' => false,
      'print_description_position' => 'below',
      'cache_table_output' => true,
      'convert_line_breaks' => true,
      'extra_css_classes' => 'tablepress-responsive',
      'use_datatables' => true,
      'datatables_sort' => true,
      'datatables_paginate' => false,
      'datatables_paginate_entries' => 10,
      'datatables_lengthchange' => true,
      'datatables_filter' => true,
      'datatables_info' => false,
      'datatables_scrollx' => false,
      'datatables_scrolly' => false,
      'datatables_custom_commands' => '"columnDefs": [ { "className": "none", "targets": [ 6,  7,  8,  9, 10 , 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ] },{ "className": "all", "targets": [ 0, 3 ] }, {"targets": [ 1 ], "visible": false, "searchable": true}], "responsive": { "details": { "renderer": function(api, rowIdx, columns) { let render_method = $.fn.dataTable.Responsive.renderer.tableAll(); return render_method(api, rowIdx, columns.filter(column => column.hidden && column.data) ); } } }
    ',
      'datatables_locale' => 'en_US',
      'show_rows' => '',
      'show_columns' => '',
      'hide_rows' => '',
      'hide_columns' => '',
      'cellspacing' => false,
      'cellpadding' => false,
      'border' => false,
      'shortcode_debug' => true,
      'datatables_columnfilterwidgets' => false,
      'datatables_columnfilterwidgets_exclude_columns' => '',
      'datatables_columnfilterwidgets_separator' => '',
      'datatables_columnfilterwidgets_max_selections' => '',
      'datatables_buttons' => '',
      'datatables_fixedheader' => '',
      'datatables_fixedheader_offsettop' => 0,
      'responsive' => 'collapse',
      'responsive_breakpoint' => 'phone',
      'filter' => 'c_coaching',
      'filter_full_cell_match' => false,
      'filter_case_sensitive' => false,
      'filter_columns' => 'all',
      'column_order' => 'default',
      'column_order_manual_order' => 'all',
      'row_order' => 'default',
      'row_order_sort_column' => false,
      'row_order_sort_direction' => 'ASC',
      'row_order_manual_order' => 'all',
      'html_id' => 'tablepress-43',
      'edit_table_url' => 'https://flauntmydesign.com/wp-admin/admin.php?page=tablepress&action=edit&table_id=43',
    )
    Thread Starter akiikiwporg

    (@akiikiwporg)

    Hi Tobias.

    I just a run a test that crashed the page, so I’ll test that again in a moment (hopefully)..

    However, I know since before that it is working to manually insert the filter term – see instance 3 in my original post.

    Thread Starter akiikiwporg

    (@akiikiwporg)

    Hello there.

    A little progress:

    I adapted your latest code to:

    <?php
    $cvht_filter ="{{mpg_cvht_tag}}";
    echo do_shortcode('[table id=43 filter="'.$cvht_filter .'" responsive="collapse" shortcode_debug=true /]');
    ?>

    The debugger then gives:

    'filter' => 'c_coaching',

    That’s the correct filter keyword.
    I also double-checked that the data in table 43 actually contains “c_coaching”, and there is 4 occurences of it.

    However, TablePress still generates an empty table.

    Here’s the rest of the debugger data:

    		
    array (
      'id' => '43',
      'column_widths' => '',
      'alternating_row_colors' => false,
      'row_hover' => false,
      'table_head' => true,
      'table_foot' => false,
      'first_column_th' => false,
      'print_name' => false,
      'print_name_position' => 'above',
      'print_description' => false,
      'print_description_position' => 'below',
      'cache_table_output' => true,
      'convert_line_breaks' => true,
      'extra_css_classes' => 'tablepress-responsive',
      'use_datatables' => true,
      'datatables_sort' => true,
      'datatables_paginate' => false,
      'datatables_paginate_entries' => 10,
      'datatables_lengthchange' => true,
      'datatables_filter' => true,
      'datatables_info' => false,
      'datatables_scrollx' => false,
      'datatables_scrolly' => false,
      'datatables_custom_commands' => '"columnDefs": [ { "className": "none", "targets": [ 6,  7,  8,  9, 10 , 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ] },{ "className": "all", "targets": [ 0, 3 ] }, {"targets": [ 1 ], "visible": false, "searchable": true}], "responsive": { "details": { "renderer": function(api, rowIdx, columns) { let render_method = $.fn.dataTable.Responsive.renderer.tableAll(); return render_method(api, rowIdx, columns.filter(column => column.hidden && column.data) ); } } }
    ',
      'datatables_locale' => 'en_US',
      'show_rows' => '',
      'show_columns' => '',
      'hide_rows' => '',
      'hide_columns' => '',
      'cellspacing' => false,
      'cellpadding' => false,
      'border' => false,
      'shortcode_debug' => true,
      'datatables_columnfilterwidgets' => false,
      'datatables_columnfilterwidgets_exclude_columns' => '',
      'datatables_columnfilterwidgets_separator' => '',
      'datatables_columnfilterwidgets_max_selections' => '',
      'datatables_buttons' => '',
      'datatables_fixedheader' => '',
      'datatables_fixedheader_offsettop' => 0,
      'responsive' => 'collapse',
      'responsive_breakpoint' => 'phone',
      'filter' => 'c_coaching',
      'filter_full_cell_match' => false,
      'filter_case_sensitive' => false,
      'filter_columns' => 'all',
      'column_order' => 'default',
      'column_order_manual_order' => 'all',
      'row_order' => 'default',
      'row_order_sort_column' => false,
      'row_order_sort_direction' => 'ASC',
      'row_order_manual_order' => 'all',
      'html_id' => 'tablepress-43',
      'edit_table_url' => 'https://flauntmydesign.com/wp-admin/admin.php?page=tablepress&action=edit&table_id=43',
    )

    If I try with “test”:

    <?php
    $cvht_filter = "test";
    echo do_shortcode('[table id=43 filter="'.$cvht_filter .'" responsive="collapse" shortcode_debug=true /]');
    ?>

    The debugger gives:

    'filter' => 'test',

    And TablePress produces a table of eight records.

    Here’s the rest of the debugger data for “test”:

    array (
      'id' => '43',
      'column_widths' => '',
      'alternating_row_colors' => false,
      'row_hover' => false,
      'table_head' => true,
      'table_foot' => false,
      'first_column_th' => false,
      'print_name' => false,
      'print_name_position' => 'above',
      'print_description' => false,
      'print_description_position' => 'below',
      'cache_table_output' => true,
      'convert_line_breaks' => true,
      'extra_css_classes' => 'tablepress-responsive',
      'use_datatables' => true,
      'datatables_sort' => true,
      'datatables_paginate' => false,
      'datatables_paginate_entries' => 10,
      'datatables_lengthchange' => true,
      'datatables_filter' => true,
      'datatables_info' => false,
      'datatables_scrollx' => false,
      'datatables_scrolly' => false,
      'datatables_custom_commands' => '"columnDefs": [ { "className": "none", "targets": [ 6,  7,  8,  9, 10 , 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ] },{ "className": "all", "targets": [ 0, 3 ] }, {"targets": [ 1 ], "visible": false, "searchable": true}], "responsive": { "details": { "renderer": function(api, rowIdx, columns) { let render_method = $.fn.dataTable.Responsive.renderer.tableAll(); return render_method(api, rowIdx, columns.filter(column => column.hidden && column.data) ); } } }
    ',
      'datatables_locale' => 'en_US',
      'show_rows' => '',
      'show_columns' => '',
      'hide_rows' => '',
      'hide_columns' => '',
      'cellspacing' => false,
      'cellpadding' => false,
      'border' => false,
      'shortcode_debug' => true,
      'datatables_columnfilterwidgets' => false,
      'datatables_columnfilterwidgets_exclude_columns' => '',
      'datatables_columnfilterwidgets_separator' => '',
      'datatables_columnfilterwidgets_max_selections' => '',
      'datatables_buttons' => '',
      'datatables_fixedheader' => '',
      'datatables_fixedheader_offsettop' => 0,
      'responsive' => 'collapse',
      'responsive_breakpoint' => 'phone',
      'filter' => 'test',
      'filter_full_cell_match' => false,
      'filter_case_sensitive' => false,
      'filter_columns' => 'all',
      'column_order' => 'default',
      'column_order_manual_order' => 'all',
      'row_order' => 'default',
      'row_order_sort_column' => false,
      'row_order_sort_direction' => 'ASC',
      'row_order_manual_order' => 'all',
      'html_id' => 'tablepress-43',
      'edit_table_url' => 'https://flauntmydesign.com/wp-admin/admin.php?page=tablepress&action=edit&table_id=43',
    )
    • This reply was modified 3 years, 2 months ago by akiikiwporg.
    Thread Starter akiikiwporg

    (@akiikiwporg)

    Here you go:

    array (
      'id' => '43',
      'column_widths' => '',
      'alternating_row_colors' => false,
      'row_hover' => false,
      'table_head' => true,
      'table_foot' => false,
      'first_column_th' => false,
      'print_name' => false,
      'print_name_position' => 'above',
      'print_description' => false,
      'print_description_position' => 'below',
      'cache_table_output' => true,
      'convert_line_breaks' => true,
      'extra_css_classes' => 'tablepress-responsive',
      'use_datatables' => true,
      'datatables_sort' => true,
      'datatables_paginate' => false,
      'datatables_paginate_entries' => 10,
      'datatables_lengthchange' => true,
      'datatables_filter' => true,
      'datatables_info' => false,
      'datatables_scrollx' => false,
      'datatables_scrolly' => false,
      'datatables_custom_commands' => '"columnDefs": [ { "className": "none", "targets": [ 6,  7,  8,  9, 10 , 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ] },{ "className": "all", "targets": [ 0, 3 ] }, {"targets": [ 1 ], "visible": false, "searchable": true}], "responsive": { "details": { "renderer": function(api, rowIdx, columns) { let render_method = $.fn.dataTable.Responsive.renderer.tableAll(); return render_method(api, rowIdx, columns.filter(column => column.hidden && column.data) ); } } }
    ',
      'datatables_locale' => 'en_US',
      'show_rows' => '',
      'show_columns' => '',
      'hide_rows' => '',
      'hide_columns' => '',
      'cellspacing' => false,
      'cellpadding' => false,
      'border' => false,
      'shortcode_debug' => true,
      'datatables_columnfilterwidgets' => false,
      'datatables_columnfilterwidgets_exclude_columns' => '',
      'datatables_columnfilterwidgets_separator' => '',
      'datatables_columnfilterwidgets_max_selections' => '',
      'datatables_buttons' => '',
      'datatables_fixedheader' => '',
      'datatables_fixedheader_offsettop' => 0,
      'responsive' => 'collapse',
      'responsive_breakpoint' => 'phone',
      'filter' => '',
      'filter_full_cell_match' => false,
      'filter_case_sensitive' => false,
      'filter_columns' => 'all',
      'column_order' => 'default',
      'column_order_manual_order' => 'all',
      'row_order' => 'default',
      'row_order_sort_column' => false,
      'row_order_sort_direction' => 'ASC',
      'row_order_manual_order' => 'all',
      'html_id' => 'tablepress-43-no-3',
      'edit_table_url' => 'https://flauntmydesign.com/wp-admin/admin.php?page=tablepress&action=edit&table_id=43',
    )
    Thread Starter akiikiwporg

    (@akiikiwporg)

    Hi again. ??

    I’m using PHP Everywhere. It’s where I added the above PHP code.

    The strange thing here is that I’m using the code in instance 1 on about 20 pages or so, and the dynamic filtering works on all of them…

    For TablePress, this is my best try so far. The code in instance 2 actually returns a table, but the data is unfiltered:

    <?php
    if($instance=="1")
    {
    $cvht_filter ="{{mpg_cvht_tag}}";
    echo do_shortcode('[ninja_tables id="50270" filter="'.$cvht_filter .'"  hide_default_filter="yes"]');
    }
    if($instance=="2")
    {
    $cvht_filter ="{{mpg_cvht_tag}}";
    echo ('[table id=43 filter=\"${cvht_filter}\" responsive=\"collapse\" /]');
    } 
    if($instance=="3")
    {
    $cvht_filter ="c_coaching";
    echo do_shortcode('[table id=43 filter="'.$cvht_filter .'"  responsive="collapse" /]');
    }
    ?>

    I replaced the above code with yours, that is:

    <?php
    echo do_shortcode('[table id=43 filter="'.$cvht_filter .'" responsive="collapse" shortcode_debug=true /]');
    ?>

    Have a look at the page.

    Thread Starter akiikiwporg

    (@akiikiwporg)

    Hi Tobias. ??

    The filter term is contained in the variable {{mpg_cvht_tag}}

    For this particular page, the actual filter term is “c_coaching”.

    So it goes something like this:

    – First, the variable {{mpg_cvht_tag}} is set to “c_coaching”. This is done by the WordPress plugin Multiple Pages Generator (MPG).

    – Second, the PHP code passes the value of {{mpg_cvht_tag}} into the PHP variable $cvht_filter.

    – Third, the PHP code is supposed to parse “c_coaching” into the shortcode, resulting in a filtered table.

    For Ninja Tables, the PHP snippet succeeds in doing so, but the code fails for TablePress.

    Thread Starter akiikiwporg

    (@akiikiwporg)

    Perfect. Thank you so much for your help, Tobias!

    Thread Starter akiikiwporg

    (@akiikiwporg)

    Thanks Tobias!

    I found a similar use case at DataTables.

    I added the following to my Custom Commands (addition in bold:)

    “columnDefs”: [ { “className”: “none”, “targets”: [ 6, 7, 8, 9, 10 , 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ] },{ “className”: “all”, “targets”: [ 0, 2, 3 ] }, {“targets”: [ 1 ], “visible”: false, “searchable”: true}], “responsive”: { “details”: { “renderer”: function(api, rowIdx, columns) { let render_method = $.fn.dataTable.Responsive.renderer.tableAll(); return render_method(api, rowIdx, columns.filter(column => column.hidden && column.data) ); } } }

    It seems to work. I added “searchable” because I want to be able to search on the hidden keywords.

    The order of the syntax I found are somewhat different compared with yours. Does it matter?

    Thread Starter akiikiwporg

    (@akiikiwporg)

    Thanks Tobias. ??

    I added your custom command like this (added part in bold:)

    “columnDefs”: [ { “className”: “none”, “targets”: [ 6, 7, 8, 9, 10 , 11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 ] },{ “className”: “all”, “targets”: [ 0, 2, 3 ] } ], “responsive”: { “details”: { “renderer”: function(api, rowIdx, columns) { let render_method = $.fn.dataTable.Responsive.renderer.tableAll(); return render_method(api, rowIdx, columns.filter(column => column.hidden && column.data) ); } } }

    (I changed the [ 2 ] part to [0, 2, 3] to make sure that column 1, 3, and 4 is always visible on a small screen.

    The above worked.

    A small complication. I have a hidden column: “examples_cvht_tags” (the 2nd column in the table.) This column is normally hidden by CSS code, but now it shows up among the unfolded data. See this image.

    This only happens on a small screen size. The hidden column is still hidden on desktop/tablet.

    Any fix for this issue?

    • This reply was modified 3 years, 2 months ago by akiikiwporg.
    Thread Starter akiikiwporg

    (@akiikiwporg)

    I think I might have found the answer to my follow up question… This CSS seems to align the values in a nice-looking way:

    .none td:first-child {
    width: 120px
    }

Viewing 15 replies - 1 through 15 (of 33 total)