Excel report select = true use for checkbox instead shift key?

Excel report select = true use for checkbox instead shift key?

trupti09trupti09 Posts: 5Questions: 2Answers: 0

I am working on datatable excel export and able to fetch only selected reports in report with the help of selection of records with Shift key.

However, can we use checkbox instead shift key to select records manually which are needed in report ?

Please advice

Answers

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin

    A checkbox like in this example? That should work. Can you link to the page showing the issue please.

    Allan

  • trupti09trupti09 Posts: 5Questions: 2Answers: 0
    edited November 2016

    Thanks for response allan.

    Yes, I have added checkbox, something similar I want to achieve like this :

    https://datatables.net/extensions/buttons/examples/print/select.html

    Currently in this example, selection is done with ctrl / shift key and those selected records are populating in Report.

    I want selection of records to be done with manually added checkbox instead of ctrl / shift key.

    for example, I will add individual checkbox for each tr, and on check of that checkbox, that tr will be selected / deselected and those selected only will be populating in Report.

    I could see , selected class applied on ctrl / shift and I have tried adding that too on checkbox check but its not working.I have attached screenshot (view_datatable_checkbox.png) where I have applied selected class on tr on checkbox click event but still that row is not present while I export report.

    Also, I am not sure to make any changes in datatable.select.js is possible ? I am not sure its possible / feasible ?

    Thanks Allan :)

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin

    You can't use a input checkbox, the example I linked to uses CSS to visually show a checkbox, when a row is selected. That you can certainly do programmatically using row().select(). You could use rows().every() to loop over all rows and select only the ones you want.

    Allan

  • trupti09trupti09 Posts: 5Questions: 2Answers: 0

    Thank you Allan.

    Selection of Rows is not a problem and it can be done manually as well.

    But the issue is even though selection of rows is done manually, those rows not populating in generated reports and its only populating in reports when selection is done with ctrl / shift (Which is its default behavior reflecting with datatable.select.min.js ).

    I just wondering why manual selection and class="selected" on tr not showing in reports.

    Thank you !!

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin

    To be honest i'm not sure either! Can you give me a link to the page so I can debug it directly please.

    Allan

  • trupti09trupti09 Posts: 5Questions: 2Answers: 0

    It's solved now and I can able to generate report with selected data by checkbox.

    Thank you so much Allan for this wonderful plugin :)

This discussion has been closed.