• Resolved James Barr

    (@james-barr)


    Hi Tobias,
    New to adding the tables and doing well so far.
    My need for tables is for a songlist that our band performs to be arranged, searched and filtered by users. Then to print, convert to pdf or copy to desktop. This has been great finding the TableTools Extension.
    The ability to select their favourite songs and secondly possibly filter that would be of great benefit.
    It says this can be done on:
    https://www.datatables.net/release-datatables/extras/TableTools/select_multi.html
    This is disabled by default.
    1. How do I enable this please?
    could you provide exact code to use and where to place it.
    2. Is it possible to filter out unselected rows to be able to use the print pdf etc…
    3. Is there an alternative function instead to select via this method, with the idea of adding a column with a checkbox function to select the rows the user wants.
    Appreciate your time
    Regards
    James

    https://www.ads-software.com/extend/plugins/tablepress/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi James,

    thanks for your question.

    1. To achieve this, you’ll basically have to change the initialization of the TableTools in the Extension. The relevant code is in line 60 of the file tablepress-datatables-tabletools.php. Basically, you’ll have to make modifications there, as described in the examples that you have found.

    2. I don’t know ?? This is TableTools functionality, and I only added that to the Extension, but am not it’s developer, so I don’t know all features. Sorry.

    3. Add a column with checkboxes should be no problem, you can do that manually in the table. You would then however have to modify the TableTools JS code to make the checkboxes work together with the multi-select.

    Regards,
    Tobias

    Thread Starter James Barr

    (@james-barr)

    Hi Tobias,

    Thanks for the reply.
    Apologies, but I really are not sure what to enter at line 60.
    I’m also using the the tabletools and fixedheader extension.
    The code is this to convert:
    $(document).ready( function () {
    $(‘#example’).dataTable( {
    “sDom”: ‘T<“clear”>lfrtip’,
    “oTableTools”: {
    “sRowSelect”: “multi”,
    “aButtons”: [ “select_all”, “select_none” ]
    }
    } );
    } );
    Could you please show me what to put.
    Can it co-exist with the extra lines I’ve added for the pdf print icons.
    Thank you
    James

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi James,

    if you are using the combined TableTools and FixedHeader Extension, you’ll have to change line 110 of the file tablepress-datatables-tabletools-fixedheader.php:

    $tabletools_options = '{ "sSwfPath": "' . $swf_path . '",
    "sRowSelect": "multi",
    "aButtons": [ "select_all", "select_none",
    { "sExtends": "copy", "sButtonText": "" }, { "sExtends": "csv", "sButtonText": "" }, { "sExtends": "xls", "sButtonText": "" }, { "sExtends": "pdf", "sButtonText": "",
    "sPdfOrientation": "landscape",
    "sPdfMessage": "Your custom message would go here."
    }, { "sExtends": "print", "sButtonText": "" } ] }';

    This should then add the multi select and the PDF text adjustments.

    Regards,
    Tobias

    Thread Starter James Barr

    (@james-barr)

    Thanks for your reply,
    The multi select has not worked, Im not seeing it function.
    The pdf text adjustment does work.
    Regards
    James

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi James,

    can you please post a link to the page with the table where you are trying this?

    Regards,
    Tobias

    Thread Starter James Barr

    (@james-barr)

    Hi Tobias,

    Thanks again. really appreciate your help.

    Here’s the link for my test page:
    https://www.atomicbandsydney.com/wp-av/songlist/

    notes: I have created some custom css for coloring, fonts and highlighting functions

    A couple of other things to note that did not function seeing you are here to look.
    1.I tried using the cookie based “bStateSave”: true in custom commands for datatables javascript library area.
    It breaks the columnfilterwidget extension, if I refresh the page. It makes me think that there must also need to be bstatesave for this extension too.
    2. I created a manual checkbox column:
    a. it will not sort from the column header
    b. the ticks or boxes do not show up in the pdf extension
    c. the ticks do show up in the print extension then use print to pdf from apple menu
    d. the columnfilterwidget for checkbox (selected) column is greyed out.

    regards

    James

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi James,

    thanks for the link!

    From what I can see, the plain multi select function is working, however, after re-reading https://datatables.net/release-datatables/extras/TableTools/select_multi.html I’m quite sure that it’s rather useless without custom programming, that – using the DataTables API functions and callbacks – “does something” with the selected rows.
    In a similar way, your points in question 2 are affected by this. Having tick boxes and interacting with them requires more than just adding them to the table. You would also need to add some programming logic, to make them sortable, to make them show in the PDF and print screen, or to integrate them into the ColumnWidgets.
    And for question 1: Yes, it looks like the ColumnWidgets plugin for DataTables doesn’t support bStateSave directly.

    So, in summary, you’ll unfortunately need custom code to achieve what you are describing. Unfortunately, I’m not the right person to help with this, as all of this has to do with DataTables and TableTools, and as I’m not the developer of those, but only added them to TablePress, I don’t have the necessary knowledge to assist with this coding. Sorry ??

    Regards,
    Tobias

    Thread Starter James Barr

    (@james-barr)

    Understand,
    Thanks for looking it for me, really appreciated your time.
    For now I’ll just use what works and explore other options later.
    All the best
    Regards
    James

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi James,

    no problem, you are very welcome!
    Sorry that I don’t have a working solution for this one.

    Best wishes,
    Tobias

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘TableTools -enable sRowSelect parameter’ is closed to new replies.