_DTTT_selected
_DTTT_selected
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
That's the problem. Try 2.2.3 and the problem should be resolved :-)
Allan
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?
To select a row, you need to use the API - specifically fnSelect. See: https://datatables.net/extensions/tabletools/api
Allan
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?
As for the selecting, I am doing this:
http://pastebin.com/7FQmpNSP
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
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...