Sheetrock, Datatable and '$.extend properties'
Sheetrock, Datatable and '$.extend properties'
Hello,
Sorry for my bad English. I'm using Google Translator.
I have the following code (working with google sheet '#my-table' and datatable):
CODE 1:
<script type="text/javascript">
// Define spreadsheet URL.
var mySpreadsheet = 'URL MY GOOGLE SHEET';
</script>
<table id="my-table" class="table table-condensed table-striped"></table>
<script type="text/javascript">
// Load all hitters and format with DataTables.
$('#my-table').sheetrock({
url: mySpreadsheet,
query: "select A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S",
}).on('sheetrock:loaded', function () {
$(this).DataTable();
});
</script>
--
And the code below (working with datatable '#my-table' (html table) and applying properties):
CODE 2:
<script type="text/javascript">
$(document).ready( function () {
var searchOptions = $.fn.dataTable.ext.deepLink( ['search.search' ] );
var language = {
"language": {
url: 'https://cdn.datatables.net/plug-ins/1.12.1/i18n/pt-BR.json'
}
};
var defaultOptions = {
"pageLength": 20,
"pagingType": "full",
lengthMenu: [20,50,100]
};
var printTable = {
dom: 'Blfrtip',
buttons: [
{
extend: 'print',
title: 'teste',
}
]
};
var dataTable = $('#my-table').DataTable($.extend( defaultOptions, searchOptions, language, printTable ));
} );
</script>
I'm trying to implement both codes (1 and 2) to "import" my spreadsheet ('#my-table' url google sheet) - CODE 1; and apply the datatable properties from the code above (deeplink, language, print button) - CODE 2.
Any suggestion?
This question has an accepted answers - jump to answer
Answers
Hey,
I was successful in putting the codes together.
I don't know if it's the correct way, but it's working.
Problem solved! I hope this helps other people.
Thanks for the update. Good to hear you got it working!
Allan