which rows are selected export those, if not export all
which rows are selected export those, if not export all
Ronak
Posts: 3Questions: 1Answers: 0
which rows are selected export those, if not export all
simply want this...
if anybody help i will thankful
PS : Great Plugin
This discussion has been closed.
Answers
@allen
According you :
https://datatables.net/forums/discussion/29493/using-select-with-buttons-not-working-correctly
There is no option for that at the moment..
and here i found another discussion thread
According @jLinux :
https://datatables.net/forums/discussion/30939/export-options-modifier-do-not-export-table-head
in this discussion below piece of code
if any rows are selected, then it will only export those selected rows, if no rows are selected, then it will export all rows..
exportOptions: {
rows: function ( idx, data, node ) {
// If rows are selected, export those, if not, export all
if($dt.rows( { selected: true } ).any())
return $.inArray(parseInt(data.asset_id), $dt.rows( { selected: true } )) !==-1;
return true;
}
i have tried it. but it didn't work for me if you little bit look into it, it will be helpful...
@Ronak, this example I mocked up for you may be a bit over-kill, but its actually code that I use in production, so it was quicker to go complicated than to code a basic version from scratch :-P
DT Example
The buttons on top are multi-level collections, Some of the top level buttons have the row counts in the labels, some are disabled if none are selected. Then once you click those, you see more options, with more labels that are based off of row counts. Then the Export Orders button has a third collection, which allows you to export all rows, the selected rows, or the rows that were filtered.
Take a looksie at the
dtCbsAndEvents.updateOperationButtons
object, which will update the button labels based on the class the button has. The callback function is executed anytime any of the numbers would change (so its fired on the events:*
draw.dt
*
page.dt
*
order.dt
*
draw.dt
*
column-visibility.dt
*
search
*
init.dt
*
deselect.dt
*
select.dt
.Hope this helps! There needs to be a little more work done on it, but this should be a good start for you.
thanks for your reply
it looks promising
i will have to dig into it
you are genius