_DTTT_selected

_DTTT_selected

christatedavieschristatedavies Posts: 6Questions: 2Answers: 0
edited September 2014 in Free community support

Hello there. We are using this fantastic library but I am struggling to use the bSelectedOnly for exporting...

I've looked into the code and done some debugging, and I can see there is a function fnGetSelected() which appears to check the _DTTT_selected property of the nodes. However, I cannot see where this gets set on the rows. Do I have to do this myself? I use the "selected" class when clicking on the rows, and this highlights them as expected. But the export ignores it, and if I console.log the items in the aforementioned function, the _DTTT_selected property is non existent.

This is using TableTools 2.2.2 and DataTables 1.10.2

Thanks for any help!

Chris

Answers

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

    This is using TableTools 2.2.2

    That's the problem. Try 2.2.3 and the problem should be resolved :-)

    Allan

  • christatedavieschristatedavies Posts: 6Questions: 2Answers: 0

    Thanks. That looks better, but do I need to tell the grid what is selected? I have set the class to "selected" but the fnGetSelectedIndexes() function is still returning nothing.

    I see the code that sets the attribute is a private function _fnRowSelect() - do I need to call something that calls that for each row?

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

    To select a row, you need to use the API - specifically fnSelect. See: https://datatables.net/extensions/tabletools/api

    Allan

  • christatedavieschristatedavies Posts: 6Questions: 2Answers: 0
    edited September 2014

    Okay, thanks for that. I have done that now, but I am struggling to set the sRowSelect to be "multi". When I use the following code, it prevents me from selecting any rows, without the setting in place, the selecting works.

    I saw the following line of code from tableTools.js:

    bSelectedOnly = this.s.select.type !== "none" && bSelectedOnly && aSelected.length !== 0;

    And I console logged this.s.select.type which led me to selecting the sRowSelect property, which I do as shown in this pastebin - http://pastebin.com/2jrTU83r

    What am I doing wrong?

  • christatedavieschristatedavies Posts: 6Questions: 2Answers: 0
    edited September 2014

    As for the selecting, I am doing this:

    http://pastebin.com/7FQmpNSP

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

    The multi select approach you have taken appears to work okay for me: http://live.datatables.net/ruhiceqa/1/edit . Clicking the rows select them.

    Can you link me to a test case showing the problem please?

    Allan

  • christatedavieschristatedavies Posts: 6Questions: 2Answers: 0

    Yeah that works for me too. I'll try and get a test for you but it won't be for a couple of days. Too busy!

    Thanks for your help thus far Allan...

This discussion has been closed.