Selected rows not recognised by TableTools, have spent a day on this now

Selected rows not recognised by TableTools, have spent a day on this now

davidKellydavidKelly Posts: 2Questions: 1Answers: 0
edited September 2014 in Free community support

Hi,

I have multi select set up and can select multiple rows in my data table. In button setup have hooked into fnClick like this:

                                  /** copy to clipboard */
                                 {
                                    "sExtends":    "copy",
                                    "sButtonText": "copy",
                                    "bSelectedOnly": true,
                                    "fnClick": function ( nButton, oConfig, flash ) {
                                        var items=this.fnGetSelectedData();
                                        this.fnSetText(flash,this.fnGetSelectedData());
                                        
                                    }

I can see that fnGetSelectedData is returning match of "selected" rows
but if I comment out line "this.fnSetText" I get ALL rows in table
IF I add that line back in I get NO rows

I have spent a day on web sites indicating that this is a very common issue but none of the proposed fixes have worked.
I tried this to validate that flash was working

"oSelectorOpts": {
                    page: 'current'
                }

And it worked - only current page of results were copied to clipboard

I simply cannot figure out what I am doing incorrectly. I thought that simply specifying "bSelectedOnly": true, would ensure that only "selected" rows would be exported as per documentation.

Please please help - it's a really great piece of software but this feature is a show stopper for me.

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Hi David,

    Thanks for your question. The bSelectedOnly option should be all that is needed - you shouldn't need to modify the fnClick method att. For example try:

    /** copy to clipboard */
    {
       "sExtends":    "copy",
       "sButtonText": "copy",
       "bSelectedOnly": true
    }
    

    One thing I would say is that there is a known bug in bSelectedOnly with DataTables 1.10 and the current TableTools release.

    This has been fixed in the source and if you could try the very latest TableTools version, hopefully it will work for you: https://github.com/DataTables/TableTools/blob/master/js/dataTables.tableTools.js .

    Let me know how you get on with it.

    Regards,
    Allan

  • davidKellydavidKelly Posts: 2Questions: 1Answers: 0

    Wonderful !!! thanks a million; problem solved by downloading that version of tableTools.

    when will this be posted to the CDN as I understand that it's better practive to use the CDN reference.

    Thanks again - life is sweet :)

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    I hope to publish an update to Editor later this week (working on a bug for it) - I'll probably publish the update for TableTools at the same time, and it will be available on the CDN then.

    Good to hear this resolved the issue for you.

    ALlan

This discussion has been closed.