How can I load colvis option on page load event?
How can I load colvis option on page load event?
deep007
Posts: 17Questions: 2Answers: 0
So, we all know when we click on the button and we have colvis option then we can make fields visible and non-visible. What I want to achieve is whenever the page gets open that colvis option gets open without clicking that button. so is there any way?
Currently I am using this code..
$('#reportCustomData').DataTable( {
dom: 'Bfrtip',
buttons: [
{
extend: 'colvis',
collectionLayout: 'fixed four-column',
text: 'Edit Rows'
},
{
extend: 'excelHtml5',
exportOptions: {
columns: ':visible',
},
text: 'Download Excel'
},
{
extend: 'pdfHtml5',
exportOptions: {
columns: [ 0, 1, 2, 5 ]
},
text: 'Download PDF'
}
]
} );
} );
This discussion has been closed.
Answers
You can use the
button().trigger()
to programmatically trigger the button.Kevin
please don't mind me asking a few questions.. regarding this.
Still, confuse.. could you please explain a bit more how can I use that trigger event in my code... I have 3 different buttons...
I have put this code in
$(document).ready(function() { }
. So i tried different ways but not getting it..Ok, let me explain where I got stuck...
on page name 'mycustomReportData' with
button().trigger()
I have load that colvis option on page load event. This is done perfectly. Thank you for your suggestion @kthorngrennow What I want to achieve is,
I am calling that report created page 'mycustomReportData' on some another page name 'customDisplayData' and opening it into a bootstrap modal. So when user click on the click event bootstrap modal will get open and it will load this ( 'mycustomReportData') page's data in its body. but on the time of the modal event, that button is not getting trigger...
In short, whenever bootstrap modal gets open it should display that colvis option. How to archive this?
here is my code.
Got the problem... over there it's get called in on document ready event but on the time of calling the bootstrap modal that event doesn't get performed... as it is just including that file not creating one...still out of solution...
I've never used Bootstrap modals but my guess is you will want to use a Modal event and use
button().trigger()
within the event.Kevin
Ok, so I have got one option for this. I have connected manually created one jQuery. That jQuery will connect colvis option with my checklist items. So on check change event, it gets trigger and then I allow the user to download it. So you can close this now. Thanks for the help.