Los Angeles Dodgers - History (2024)

Stories, Photos, Videos, Podcasts, and Publications featuring Los Angeles Dodgers History

F i l t e r & S o r t Filter & Sort

'+tableLegend; } else { return '

Showing ' + total + ' of ' + max + ' records.
Change filters or adjust season slider to modify results.
Click on column headings to sort table.

'+tableLegend;} } , fnFooterCallback: function ( nRow, aaData, iStart, iEnd, aiDisplay ) { //cant get actual 2+ row footers to work below or elsewhere, so just using
on footer results var api = this.api(); $('tr:eq(1) th:eq(3)', api.table().footer()).html((34)); $('tr:eq(1) th:eq(4)', api.table().footer()).html((53)); $('tr:eq(1) th:eq(5)', api.table().footer()).html((12)); // var secondRow = $(nRow).next()[0]; // var nCells = secondRow.getElementsByTagName('th'); // nCells[1].innerHTML = 55; // nCells[2].innerHTML = 47.01; // console.log(nCells); }, // ========================================================== // Functions that automatically calculate sum/average/etc on footer of each column // // each column's class attribute is tagged as to what type of subtotal should be calculated // ========================================================== drawCallback: function () { //sums the footer values var api = this.api(); var ct=0; //index counter var rowCt=0; //count number of rows in particular column var seaCt=0; //number of seasons visible //counts the rows in first column and shows as ## Totals api.columns('.tot', { page: 'current' }).every(function () { var sum = this .data() .reduce(function (a, b) { if (b!='') { ct++; } return ''; }, 0); seaCt = ct; ct=0; //console.log('=='+sum+'/'+ct+'/'+seaCt); // Update footer of first column if (seaCt>1 && !0) { //season totals and average $(this.footer()).html(seaCt+"
" ); }else if (seaCt>1 ) { $(this.footer()).html(seaCt+" " ); }else{ $(this.footer()).html(seaCt+" " ); } }); // ============================================================ // Calculate Averages on columns that are already averages by grabbing data // from other column Totals // e.g. FG%, Batting Average, SLG, etc // ============================================================ // call from each page , for example: // var colclass = '.3Ppct-calc' // var numerFld = '3Ptot:name' // var denomFld = '3PAtot:name' // var sigfig = 1 // var decPct = 100 // var strip0 = true //strip leading "0." from results 0.500 -> .500 // var numerVal = parseFloat(api.column( numerFld, {page:'current'} ).data().sum(0)) // var denomVal = parseFloat(api.column( denomFld, {page:'current'} ).data().sum(0)) // customFooterVal(); function customFooterVal() { // some columns may have null stats, so cant include those in averages. // This javascript technique iterates one column at a time // So it becomes problematic to count rows in a _different_ column to get accurate averages/per-game totals. // so instead, we'll just get a ratio of the rows with/without null in _current_ column // and then multiply subtotal by that ratio to get a best estimate. // Mostly accurate unless game counts vary from season to season. // var numerCt = parseFloat(api.column( numerFld, {page:'current'} ).data().filter( function ( value, index ) {return value !='' ? true : false; } ).count()+0.00001); //counts non-nulls var denomCt = parseFloat(api.column( denomFld, {page:'current'} ).data().filter( function ( value, index ) {return value !='' ? true : false; } ).count()); //counts non=nulls var subave = ( (denomCt / numerCt) * numerVal / ( denomVal + 0.00001 ) * decPct ).toFixed(sigfig); //create footer if (numerCt<1) { subave='-'; //no stats in column }else if (strip0) { subave=subave.replace(/^(0\.)/,'.') ; //strip leading "0." from results 0.500 -> .500 } if (seaCt>1 && !0) { subave = subave + '
' + subave } jQuery( api.table().column( colclass ).footer() ).html( ( subave ) ); } // console.log('---------') // console.log ('1:'+ parseFloat(api.column( '3Ptot:name', {page:'current'} ).data().filter( // function ( value, index ) {return value !='' ? true : false; } ).count())) // console.log ('2:'+ parseFloat(api.column( '3PAtot:name', {page:'current'} ).data().filter( // function ( value, index ) {return value !='' ? true : false; } ).count())) // the sigfig and 'leading 0' are stored in database also creates // a custom class. for use in javascript calcuations of dynamic footer calculations // not currently used // ========================= // footer with sum and average // ========================= api.columns('.sumave00', { page: 'current' }).every(function () { var strip0 =0; var sigfig =0; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } sum = parseInt(sum); $(this.footer()).html(sum + ave ); }); api.columns('.sumave01', { page: 'current' }).every(function () { var strip0 =0; var sigfig =1; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } sum = parseInt(sum); $(this.footer()).html(sum + ave ); }); api.columns('.sumave02', { page: 'current' }).every(function () { var strip0 =0; var sigfig =2; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } sum = parseInt(sum); $(this.footer()).html(sum + ave ); }); api.columns('.sumave03', { page: 'current' }).every(function () { var strip0 =0; var sigfig =3; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } sum = parseInt(sum); $(this.footer()).html(sum + ave ); }); api.columns('.sumave11', { page: 'current' }).every(function () { var strip0 =1; var sigfig =1; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } sum = parseInt(sum); $(this.footer()).html(sum + ave ); }); api.columns('.sumave12', { page: 'current' }).every(function () { var strip0 =1; var sigfig =2; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } sum = parseInt(sum); $(this.footer()).html(sum + ave ); }); api.columns('.sumave13', { page: 'current' }).every(function () { var strip0 =1; var sigfig =3; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } sum = parseInt(sum); $(this.footer()).html(sum + ave ); }); // ========================= // footer with two averages // ========================= api.columns('.aveave00', { page: 'current' }).every(function () { var strip0 =0; var sigfig =0; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } $(this.footer()).html( sumAlt + ave ); }); api.columns('.aveave01', { page: 'current' }).every(function () { var strip0 =0; var sigfig =1; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } $(this.footer()).html( sumAlt + ave ); }); api.columns('.aveave02', { page: 'current' }).every(function () { var strip0 =0; var sigfig =2; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } $(this.footer()).html( sumAlt + ave ); }); api.columns('.aveave03', { page: 'current' }).every(function () { var strip0 =0; var sigfig =3; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } $(this.footer()).html( sumAlt + ave ); }); api.columns('.aveave11', { page: 'current' }).every(function () { var strip0 =1; var sigfig =1; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } $(this.footer()).html( sumAlt + ave ); }); api.columns('.aveave12', { page: 'current' }).every(function () { var strip0 =1; var sigfig =2; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } $(this.footer()).html( sumAlt + ave ); }); api.columns('.aveave13', { page: 'current' }).every(function () { var strip0 =1; var sigfig =3; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } $(this.footer()).html( sumAlt + ave ); }); //these two should be obsolete, but keeping them here for legacy purposes api.columns('.aveave', { page: 'current' }).every(function () { var strip0 =1; var sigfig =1; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } $(this.footer()).html( sumAlt + ave ); }); //these two should be obsolete, but keeping them here for legacy purposes api.columns('.sumave', { page: 'current' }).every(function () { var strip0 =1; var sigfig =1; var sum = this .data() .reduce(function (a, b) { var x = parseFloat($(''+a+'').text()) || 0; //encase it so html is always stripped var y = parseFloat($(''+b+'').text()) || 0; if (y!='') { ct++; } return x + y; }, 0); var rowCt = ct; ct=0; // Update footer if (rowCt==0) { sum='-'; sumAlt='-'; }else{ sum = parseFloat(sum).toFixed(4) sumAlt = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) if (strip0==1){ sumAlt = sumAlt.replace(/^(0\.)/,'.'); } } if (rowCt==0 && seaCt>1 && !0*1) { ave = '
-'; }else if (seaCt>1 && !0*1) { ave = parseFloat(sum/(rowCt+.000001)).toFixed(sigfig) ; if (strip0==1){ ave = ave.replace(/^(0\.)/,'.'); } ave = '
'+ ave ; }else{ ave = ''; //dont show second row when there's only 1 season } sum = parseInt(sum); $(this.footer()).html(sum + ave ); }); //dont really use these anymore because two-rowed footer code above places average after the sum //other columns are autocalculated based for average or sum based on class tag // api.columns('.sumonly', { page: 'current' }).every(function (rowIdx, tableLoop, rowLoop) { // var sum = this // .data() // .reduce(function (a, b) { // var x = parseFloat(a) || 0; // var y = parseFloat(b) || 0; // return x + y; // }, 0); // //console.log(sum); // // Update footer // $(this.footer()).html(parseFloat(sum).toFixed(0) ); // }); // api.columns('.avg3', { page: 'current' }).every(function () { // var sum = this // .data() // .reduce(function (a, b) { // var x = parseFloat(a) || 0; // var y = parseFloat(b) || 0; // if (b!='') { // ct++; // } // return x + y; // }, 0); // var rowCt = ct; // ct=0; // //console.log('=='+sum+'/'+ct+'/'+rowCt); // // Update footer // $(this.footer()).html( parseFloat(sum/(rowCt+.000001)).toFixed(3).replace('0.','.') ); // }); //api.fixedHeader.adjust(); }, buttons: [ // ========================================================== // Build VIEWS dropdown menu // ========================================================== // // ========================================================== // Build SPLITS dropdown menu // ========================================================== // { // extend: 'collection', // text: " Splits", // fade: 0, // autoClose: true, // buttons: // [ // // ] // }, // ========================================================== // Build COLUMN visibility dropdown menu // ========================================================== // checkboxes at // https://infra.clarin.eu/content/libs/DataTables-1.10.4/extensions/ColVis/examples/text.html // { extend: 'colvis', fade: 0, className: 'btn-group-child pull-left', //collectionLayout: 'fixed two-column', columns: ":not(.notInMenu)", //':gt(0)', titleAttr: 'Hide/Show Columns', text: "Columns" }, // ========================================================== // Build EXPORT/SHARE dropdown menu // ========================================================== // { extend: "collection", text: "Share", fade: 0, titleAttr: 'Export Table to another location', className: 'btn-group-child', autoClose: true, buttons: [ { extend: 'copy', className: 'pullLeft', messageTop: 'RetroSeasons Data', messageBottom: "https://www.retroseasons.com/teams/los-angeles-dodgers/fernando-valenzuela-wins-rookie-of-year-and-cy-young-award-in-1981/", header: true, footer: true, text: "Copy/Paste", key: { key: 'c', ctrlKey: true, }, exportOptions: { columns: ':visible' }, }, { extend: 'csv', className: 'pullLeft', title: "retroseasons-teams-los-angeles-dodgers-fernando-valenzuela-wins-rookie-of-year-and-cy-young-award-in-1981-export", messageBottom: "https://www.retroseasons.com/teams/los-angeles-dodgers/fernando-valenzuela-wins-rookie-of-year-and-cy-young-award-in-1981/", messageTop: "This data was exported from https://www.retroseasons.com", text: "Download", titleAttr: 'Download Stats', header: true, footer: true, key: { key: 'x', ctrlKey: true, }, exportOptions: { columns: ':visible' }, }, // { // text: " Facebook Share", // titleAttr: 'Share Page', // }, // { // text: " Share Page", // titleAttr: 'Share Page', // }, // { // text: " Embed Table", // titleAttr: 'Embed Table', // }, ] }, // ========================================================== // Build FILTERS dropdown menu // ========================================================== // { extend: "collection", text: "Filter", autoClose: true, titleAttr: 'Filter statistics to show a subset of data', className: 'btn-group-child', fade: 0, buttons: [ // ========================================================== // FILTER paramater variables are set on each page depending on data // ========================================================== ] }, //end of collection dropdown menu ], }); //redraws header/footer on colviz changes so that its correctly formatted jQuery('#mainTable').on( 'column-visibility.dt', function ( e, settings, column, state ) { //console.log( 'Column '+ column +' has changed to '+ (state ? 'visible' : 'hidden') ); table.fixedHeader.adjust(); } ); jQuery('#mainTable').show(); // ================================================================= // draw table filtering fields to allow filtering of ranges // (this technique is then piggybacked by the range slider) // ================================================================= jQuery.fn.dataTable.ext.search.push( function( settings, data, dataIndex ) { var min = parseInt( jQuery('#slider-min').val(), 10 ); var max = parseInt( jQuery('#slider-max').val(), 10 ); var age = parseFloat( data[0] ) || 0; // use data for the age column if ( ( isNaN( min ) && isNaN( max ) ) || ( isNaN( min ) && age <= max ) || ( min <= age && isNaN( max ) ) || ( min <= age && age <= max ) ) { return true; } return false; } ); // ================================================================= // Event listener to the two range filtering inputs to redraw on input. // don't really need this anymore, since they're hidden and // i'm triggering redraw on slider but leaving it here for legacy // ================================================================= jQuery('#slider-min, #slider-max').change( function() { table.draw(); } ); // ================================================================= // Avtandil mod: throttle slide change events // ================================================================= var throttle_inst = null; var throttle = function( wait, func, options) { var context, args, result; var timeout = null; var previous = 0; if (!options) options = {}; var later = function() { previous = options.leading === false ? 0 : Date.now(); timeout = null; result = func.apply(context, args); if (!timeout) context = args = null; }; return function() { var now = Date.now(); if (!previous && options.leading === false) previous = now; var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0 || remaining > wait) { if (timeout) { clearTimeout(timeout); timeout = null; } previous = now; result = func.apply(context, args); if (!timeout) context = args = null; } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; } var update_model_throttle = function() { if (null === throttle_inst) { throttle_inst = throttle(500, function(){ demo._handleSliderChange(); }); } throttle_inst(); } // ================================================================= // Avtandil End: throttle slide change events // ================================================================= // ================================================================= // set config parameters for slider range // http://ionden.com/a/plugins/ion.rangeSlider/demo_interactions.html // ================================================================= var $range = jQuery("#slider-range"); jQuery(function () { $range.ionRangeSlider({ type: 'double', step: 1, min: 1884, max: 2021, from: 1884, to: 2021, from_min: 1884, to_min: 1884, from_max: 2021, to_max: 2021, hide_min_max: false, keyboard: false, from_shadow:true, grid: false, skin: "round", // skin: "big", force_edges: true, drag_interval: true, prettify_enabled: false ,onChange: function () { update_model_throttle(); } }); }); $('div.dataTables_filter input').addClass('focus:border-blue-500 focus:border-2'); // <-- add this line $('div.dataTables_filter input').addClass('rounded rounded-lg border border-gray-400'); // <-- add this line $('div.dataTables_filter input').addClass('text-black'); // <-- add this line // ================================================================= // change min/max input fields and redraw table when slider changes // ================================================================= $range.on("change", function () { var $this = $(this), value = $this.prop("value").split(";"); //console.log(value[0] + " - " + value[1]); document.getElementById('slider-min').value=value[0]; document.getElementById('slider-max').value=value[1]; table.draw(); }); //fixedHeader.adjust(); //breaks wordpress table.draw(); $('#crumbCell').html(''); } );

0 matches

As someone deeply familiar with data manipulation, JavaScript, and web development, I understand that the provided code is part of a web page that uses the DataTables library to display and manipulate tabular data related to the history of the Los Angeles Dodgers baseball team. The code includes various functionalities, such as filtering, sorting, and calculating column sums and averages dynamically.

Let me break down the main concepts and functionalities used in the provided code:

  1. DataTables Initialization and Configuration:

    • The code initializes a DataTable on an HTML table with the ID 'mainTable'.
    • Configuration options are set for the DataTable, including callback functions for drawing, filtering, and column visibility.
  2. Footer Callbacks:

    • Callback functions are defined for the footer of the table to display calculated sums or totals for specific columns.
  3. Column Sum and Average Calculation:

    • Functions are created to calculate sums and averages for specific columns.
    • The calculations take into account the visibility of columns and apply filtering based on the current page.
  4. Dropdown Menus for Views, Splits, Columns, Export/Share, and Filters:

    • The code creates dropdown menus with various options, such as hiding/showing columns, exporting data, and applying filters.
    • The export functionality allows copying data to the clipboard or downloading it as a CSV file.
  5. Event Handling:

    • Event handlers are implemented to respond to changes in column visibility, ensuring the correct formatting of the table header and footer.
  6. Range Filtering:

    • There are indications that range filtering is implemented, allowing users to filter data within specific numeric ranges.
  7. URL Sharing and Embedding:

    • The export options include sharing the table URL and downloading data, enabling users to share specific views of the data.
  8. Data Source:

    • The code references a data source related to the Los Angeles Dodgers' history, including details about Fernando Valenzuela winning Rookie of the Year and Cy Young Award in 1981.
  9. Legacy Code:

    • Some sections of the code are marked as "obsolete" or "legacy," suggesting that certain functionalities may no longer be actively used but are retained for historical purposes.

Overall, the code demonstrates a comprehensive use of DataTables and associated plugins to create an interactive and feature-rich table for exploring and analyzing Los Angeles Dodgers' historical data.

Los Angeles Dodgers - History (2024)
Top Articles
Latest Posts
Article information

Author: Mr. See Jast

Last Updated:

Views: 6054

Rating: 4.4 / 5 (55 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Mr. See Jast

Birthday: 1999-07-30

Address: 8409 Megan Mountain, New Mathew, MT 44997-8193

Phone: +5023589614038

Job: Chief Executive

Hobby: Leather crafting, Flag Football, Candle making, Flying, Poi, Gunsmithing, Swimming

Introduction: My name is Mr. See Jast, I am a open, jolly, gorgeous, courageous, inexpensive, friendly, homely person who loves writing and wants to share my knowledge and understanding with you.