From daf309d7f17e268a704d006b3db1f363073165c7 Mon Sep 17 00:00:00 2001 From: "Max.Guglielmi" Date: Sun, 7 Sep 2014 17:56:17 +1000 Subject: [PATCH] Added folder structure, js files to be changed, Gruntfile and package.json --- .gitignore | 3 +- Gruntfile.js | 99 + dist/TF_Modules/tf_alternateRows.js | 71 + dist/TF_Modules/tf_colOps.js | 271 + dist/TF_Modules/tf_cookies.js | 163 + dist/TF_Modules/tf_extensions.js | 53 + dist/TF_Modules/tf_ezEditTable.js | 253 + dist/TF_Modules/tf_fixedHeaders.js | 95 + dist/TF_Modules/tf_gridLayout.js | 307 + dist/TF_Modules/tf_highlightKeywords.js | 97 + dist/TF_Modules/tf_loader.js | 72 + dist/TF_Modules/tf_paging.js | 598 ++ dist/TF_Modules/tf_populateCheckList.js | 325 + dist/TF_Modules/tf_populateSelect.js | 276 + dist/TF_Modules/tf_popupFilters.js | 161 + dist/TF_Modules/tf_publicMethods.js | 230 + dist/TF_Modules/tf_refreshFilters.js | 51 + dist/TF_Modules/tf_resetBtn.js | 174 + dist/TF_Modules/tf_rowsCounter.js | 100 + dist/TF_Modules/tf_sort.js | 58 + dist/TF_Modules/tf_statusBar.js | 110 + dist/TF_Modules/tf_themes.js | 81 + dist/TF_Modules/tf_watermark.js | 27 + dist/TF_Themes/Default/TF_Default.css | 98 + dist/TF_Themes/Default/images/bg_infDiv.jpg | Bin 0 -> 303 bytes dist/TF_Themes/Default/images/bg_th.jpg | Bin 0 -> 326 bytes dist/TF_Themes/Default/images/btn_eraser.gif | Bin 0 -> 356 bytes .../Default/images/btn_first_page.gif | Bin 0 -> 332 bytes .../Default/images/btn_last_page.gif | Bin 0 -> 331 bytes .../Default/images/btn_next_page.gif | Bin 0 -> 187 bytes .../Default/images/btn_over_eraser.gif | Bin 0 -> 440 bytes .../Default/images/btn_over_first_page.gif | Bin 0 -> 640 bytes .../Default/images/btn_over_last_page.gif | Bin 0 -> 427 bytes .../Default/images/btn_over_next_page.gif | Bin 0 -> 393 bytes .../Default/images/btn_over_previous_page.gif | Bin 0 -> 395 bytes .../Default/images/btn_previous_page.gif | Bin 0 -> 290 bytes dist/TF_Themes/Default/images/img_loading.gif | Bin 0 -> 3236 bytes dist/TF_Themes/MyTheme/MyTheme.css | 119 + dist/TF_Themes/MyTheme/images/bg_headers.jpg | Bin 0 -> 300 bytes dist/TF_Themes/MyTheme/images/bg_infDiv.jpg | Bin 0 -> 303 bytes dist/TF_Themes/MyTheme/images/btn_filter.png | Bin 0 -> 928 bytes .../MyTheme/images/btn_first_page.gif | Bin 0 -> 63 bytes .../MyTheme/images/btn_last_page.gif | Bin 0 -> 61 bytes .../MyTheme/images/btn_next_page.gif | Bin 0 -> 59 bytes .../MyTheme/images/btn_previous_page.gif | Bin 0 -> 58 bytes dist/TF_Themes/MyTheme/images/img_loading.gif | Bin 0 -> 8787 bytes dist/TF_Themes/SkyBlue/TF_SkyBlue.css | 148 + dist/TF_Themes/SkyBlue/images/bg_skyblue.gif | Bin 0 -> 554 bytes .../SkyBlue/images/btn_first_page.gif | Bin 0 -> 118 bytes .../SkyBlue/images/btn_last_page.gif | Bin 0 -> 118 bytes .../SkyBlue/images/btn_next_page.gif | Bin 0 -> 97 bytes .../SkyBlue/images/btn_prev_page.gif | Bin 0 -> 97 bytes .../SkyBlue/images/icn_clear_filters.png | Bin 0 -> 601 bytes dist/TF_Themes/SkyBlue/images/img_loading.gif | Bin 0 -> 847 bytes dist/TF_Themes/blank.png | Bin 0 -> 144 bytes dist/TF_Themes/btn_clear_filters.png | Bin 0 -> 360 bytes dist/TF_Themes/btn_filter.png | Bin 0 -> 325 bytes dist/TF_Themes/btn_first_page.gif | Bin 0 -> 63 bytes dist/TF_Themes/btn_last_page.gif | Bin 0 -> 61 bytes dist/TF_Themes/btn_next_page.gif | Bin 0 -> 59 bytes dist/TF_Themes/btn_previous_page.gif | Bin 0 -> 58 bytes dist/TF_Themes/downsimple.png | Bin 0 -> 201 bytes dist/TF_Themes/icn_filter.gif | Bin 0 -> 68 bytes dist/TF_Themes/icn_filterActive.gif | Bin 0 -> 78 bytes dist/TF_Themes/upsimple.png | Bin 0 -> 201 bytes dist/filtergrid-uncompressed.css | 328 + dist/filtergrid.css | 7 + dist/tablefilter-uncompressed.js | 2739 ++++++++ dist/tablefilter_all-uncompressed.js | 5959 +++++++++++++++++ dist/tablefilter_all.js | 10 + package.json | 15 + src/TF_Modules/tf_alternateRows.js | 71 + src/TF_Modules/tf_colOps.js | 271 + src/TF_Modules/tf_cookies.js | 163 + src/TF_Modules/tf_extensions.js | 53 + src/TF_Modules/tf_ezEditTable.js | 253 + src/TF_Modules/tf_fixedHeaders.js | 95 + src/TF_Modules/tf_gridLayout.js | 307 + src/TF_Modules/tf_highlightKeywords.js | 97 + src/TF_Modules/tf_loader.js | 72 + src/TF_Modules/tf_paging.js | 598 ++ src/TF_Modules/tf_populateCheckList.js | 325 + src/TF_Modules/tf_populateSelect.js | 276 + src/TF_Modules/tf_popupFilters.js | 161 + src/TF_Modules/tf_publicMethods.js | 230 + src/TF_Modules/tf_refreshFilters.js | 51 + src/TF_Modules/tf_resetBtn.js | 174 + src/TF_Modules/tf_rowsCounter.js | 100 + src/TF_Modules/tf_sort.js | 58 + src/TF_Modules/tf_statusBar.js | 110 + src/TF_Modules/tf_themes.js | 81 + src/TF_Modules/tf_watermark.js | 27 + src/TF_Themes/Default/TF_Default.css | 98 + src/TF_Themes/Default/images/bg_infDiv.jpg | Bin 0 -> 303 bytes src/TF_Themes/Default/images/bg_th.jpg | Bin 0 -> 326 bytes src/TF_Themes/Default/images/btn_eraser.gif | Bin 0 -> 356 bytes .../Default/images/btn_first_page.gif | Bin 0 -> 332 bytes .../Default/images/btn_last_page.gif | Bin 0 -> 331 bytes .../Default/images/btn_next_page.gif | Bin 0 -> 187 bytes .../Default/images/btn_over_eraser.gif | Bin 0 -> 440 bytes .../Default/images/btn_over_first_page.gif | Bin 0 -> 640 bytes .../Default/images/btn_over_last_page.gif | Bin 0 -> 427 bytes .../Default/images/btn_over_next_page.gif | Bin 0 -> 393 bytes .../Default/images/btn_over_previous_page.gif | Bin 0 -> 395 bytes .../Default/images/btn_previous_page.gif | Bin 0 -> 290 bytes src/TF_Themes/Default/images/img_loading.gif | Bin 0 -> 3236 bytes src/TF_Themes/MyTheme/MyTheme.css | 119 + src/TF_Themes/MyTheme/images/bg_headers.jpg | Bin 0 -> 300 bytes src/TF_Themes/MyTheme/images/bg_infDiv.jpg | Bin 0 -> 303 bytes src/TF_Themes/MyTheme/images/btn_filter.png | Bin 0 -> 928 bytes .../MyTheme/images/btn_first_page.gif | Bin 0 -> 63 bytes .../MyTheme/images/btn_last_page.gif | Bin 0 -> 61 bytes .../MyTheme/images/btn_next_page.gif | Bin 0 -> 59 bytes .../MyTheme/images/btn_previous_page.gif | Bin 0 -> 58 bytes src/TF_Themes/MyTheme/images/img_loading.gif | Bin 0 -> 8787 bytes src/TF_Themes/SkyBlue/TF_SkyBlue.css | 148 + src/TF_Themes/SkyBlue/images/bg_skyblue.gif | Bin 0 -> 554 bytes .../SkyBlue/images/btn_first_page.gif | Bin 0 -> 118 bytes .../SkyBlue/images/btn_last_page.gif | Bin 0 -> 118 bytes .../SkyBlue/images/btn_next_page.gif | Bin 0 -> 97 bytes .../SkyBlue/images/btn_prev_page.gif | Bin 0 -> 97 bytes .../SkyBlue/images/icn_clear_filters.png | Bin 0 -> 601 bytes src/TF_Themes/SkyBlue/images/img_loading.gif | Bin 0 -> 847 bytes src/TF_Themes/blank.png | Bin 0 -> 144 bytes src/TF_Themes/btn_clear_filters.png | Bin 0 -> 360 bytes src/TF_Themes/btn_filter.png | Bin 0 -> 325 bytes src/TF_Themes/btn_first_page.gif | Bin 0 -> 63 bytes src/TF_Themes/btn_last_page.gif | Bin 0 -> 61 bytes src/TF_Themes/btn_next_page.gif | Bin 0 -> 59 bytes src/TF_Themes/btn_previous_page.gif | Bin 0 -> 58 bytes src/TF_Themes/downsimple.png | Bin 0 -> 201 bytes src/TF_Themes/icn_filter.gif | Bin 0 -> 68 bytes src/TF_Themes/icn_filterActive.gif | Bin 0 -> 78 bytes src/TF_Themes/upsimple.png | Bin 0 -> 201 bytes src/filtergrid.css | 328 + src/tablefilter.js | 2739 ++++++++ src/tablefilter_all.js | 5959 +++++++++++++++++ 137 files changed, 26061 insertions(+), 1 deletion(-) create mode 100644 Gruntfile.js create mode 100644 dist/TF_Modules/tf_alternateRows.js create mode 100644 dist/TF_Modules/tf_colOps.js create mode 100644 dist/TF_Modules/tf_cookies.js create mode 100644 dist/TF_Modules/tf_extensions.js create mode 100644 dist/TF_Modules/tf_ezEditTable.js create mode 100644 dist/TF_Modules/tf_fixedHeaders.js create mode 100644 dist/TF_Modules/tf_gridLayout.js create mode 100644 dist/TF_Modules/tf_highlightKeywords.js create mode 100644 dist/TF_Modules/tf_loader.js create mode 100644 dist/TF_Modules/tf_paging.js create mode 100644 dist/TF_Modules/tf_populateCheckList.js create mode 100644 dist/TF_Modules/tf_populateSelect.js create mode 100644 dist/TF_Modules/tf_popupFilters.js create mode 100644 dist/TF_Modules/tf_publicMethods.js create mode 100644 dist/TF_Modules/tf_refreshFilters.js create mode 100644 dist/TF_Modules/tf_resetBtn.js create mode 100644 dist/TF_Modules/tf_rowsCounter.js create mode 100644 dist/TF_Modules/tf_sort.js create mode 100644 dist/TF_Modules/tf_statusBar.js create mode 100644 dist/TF_Modules/tf_themes.js create mode 100644 dist/TF_Modules/tf_watermark.js create mode 100644 dist/TF_Themes/Default/TF_Default.css create mode 100644 dist/TF_Themes/Default/images/bg_infDiv.jpg create mode 100644 dist/TF_Themes/Default/images/bg_th.jpg create mode 100644 dist/TF_Themes/Default/images/btn_eraser.gif create mode 100644 dist/TF_Themes/Default/images/btn_first_page.gif create mode 100644 dist/TF_Themes/Default/images/btn_last_page.gif create mode 100644 dist/TF_Themes/Default/images/btn_next_page.gif create mode 100644 dist/TF_Themes/Default/images/btn_over_eraser.gif create mode 100644 dist/TF_Themes/Default/images/btn_over_first_page.gif create mode 100644 dist/TF_Themes/Default/images/btn_over_last_page.gif create mode 100644 dist/TF_Themes/Default/images/btn_over_next_page.gif create mode 100644 dist/TF_Themes/Default/images/btn_over_previous_page.gif create mode 100644 dist/TF_Themes/Default/images/btn_previous_page.gif create mode 100644 dist/TF_Themes/Default/images/img_loading.gif create mode 100644 dist/TF_Themes/MyTheme/MyTheme.css create mode 100644 dist/TF_Themes/MyTheme/images/bg_headers.jpg create mode 100644 dist/TF_Themes/MyTheme/images/bg_infDiv.jpg create mode 100644 dist/TF_Themes/MyTheme/images/btn_filter.png create mode 100644 dist/TF_Themes/MyTheme/images/btn_first_page.gif create mode 100644 dist/TF_Themes/MyTheme/images/btn_last_page.gif create mode 100644 dist/TF_Themes/MyTheme/images/btn_next_page.gif create mode 100644 dist/TF_Themes/MyTheme/images/btn_previous_page.gif create mode 100644 dist/TF_Themes/MyTheme/images/img_loading.gif create mode 100644 dist/TF_Themes/SkyBlue/TF_SkyBlue.css create mode 100644 dist/TF_Themes/SkyBlue/images/bg_skyblue.gif create mode 100644 dist/TF_Themes/SkyBlue/images/btn_first_page.gif create mode 100644 dist/TF_Themes/SkyBlue/images/btn_last_page.gif create mode 100644 dist/TF_Themes/SkyBlue/images/btn_next_page.gif create mode 100644 dist/TF_Themes/SkyBlue/images/btn_prev_page.gif create mode 100644 dist/TF_Themes/SkyBlue/images/icn_clear_filters.png create mode 100644 dist/TF_Themes/SkyBlue/images/img_loading.gif create mode 100644 dist/TF_Themes/blank.png create mode 100644 dist/TF_Themes/btn_clear_filters.png create mode 100644 dist/TF_Themes/btn_filter.png create mode 100644 dist/TF_Themes/btn_first_page.gif create mode 100644 dist/TF_Themes/btn_last_page.gif create mode 100644 dist/TF_Themes/btn_next_page.gif create mode 100644 dist/TF_Themes/btn_previous_page.gif create mode 100644 dist/TF_Themes/downsimple.png create mode 100644 dist/TF_Themes/icn_filter.gif create mode 100644 dist/TF_Themes/icn_filterActive.gif create mode 100644 dist/TF_Themes/upsimple.png create mode 100644 dist/filtergrid-uncompressed.css create mode 100644 dist/filtergrid.css create mode 100644 dist/tablefilter-uncompressed.js create mode 100644 dist/tablefilter_all-uncompressed.js create mode 100644 dist/tablefilter_all.js create mode 100644 package.json create mode 100644 src/TF_Modules/tf_alternateRows.js create mode 100644 src/TF_Modules/tf_colOps.js create mode 100644 src/TF_Modules/tf_cookies.js create mode 100644 src/TF_Modules/tf_extensions.js create mode 100644 src/TF_Modules/tf_ezEditTable.js create mode 100644 src/TF_Modules/tf_fixedHeaders.js create mode 100644 src/TF_Modules/tf_gridLayout.js create mode 100644 src/TF_Modules/tf_highlightKeywords.js create mode 100644 src/TF_Modules/tf_loader.js create mode 100644 src/TF_Modules/tf_paging.js create mode 100644 src/TF_Modules/tf_populateCheckList.js create mode 100644 src/TF_Modules/tf_populateSelect.js create mode 100644 src/TF_Modules/tf_popupFilters.js create mode 100644 src/TF_Modules/tf_publicMethods.js create mode 100644 src/TF_Modules/tf_refreshFilters.js create mode 100644 src/TF_Modules/tf_resetBtn.js create mode 100644 src/TF_Modules/tf_rowsCounter.js create mode 100644 src/TF_Modules/tf_sort.js create mode 100644 src/TF_Modules/tf_statusBar.js create mode 100644 src/TF_Modules/tf_themes.js create mode 100644 src/TF_Modules/tf_watermark.js create mode 100644 src/TF_Themes/Default/TF_Default.css create mode 100644 src/TF_Themes/Default/images/bg_infDiv.jpg create mode 100644 src/TF_Themes/Default/images/bg_th.jpg create mode 100644 src/TF_Themes/Default/images/btn_eraser.gif create mode 100644 src/TF_Themes/Default/images/btn_first_page.gif create mode 100644 src/TF_Themes/Default/images/btn_last_page.gif create mode 100644 src/TF_Themes/Default/images/btn_next_page.gif create mode 100644 src/TF_Themes/Default/images/btn_over_eraser.gif create mode 100644 src/TF_Themes/Default/images/btn_over_first_page.gif create mode 100644 src/TF_Themes/Default/images/btn_over_last_page.gif create mode 100644 src/TF_Themes/Default/images/btn_over_next_page.gif create mode 100644 src/TF_Themes/Default/images/btn_over_previous_page.gif create mode 100644 src/TF_Themes/Default/images/btn_previous_page.gif create mode 100644 src/TF_Themes/Default/images/img_loading.gif create mode 100644 src/TF_Themes/MyTheme/MyTheme.css create mode 100644 src/TF_Themes/MyTheme/images/bg_headers.jpg create mode 100644 src/TF_Themes/MyTheme/images/bg_infDiv.jpg create mode 100644 src/TF_Themes/MyTheme/images/btn_filter.png create mode 100644 src/TF_Themes/MyTheme/images/btn_first_page.gif create mode 100644 src/TF_Themes/MyTheme/images/btn_last_page.gif create mode 100644 src/TF_Themes/MyTheme/images/btn_next_page.gif create mode 100644 src/TF_Themes/MyTheme/images/btn_previous_page.gif create mode 100644 src/TF_Themes/MyTheme/images/img_loading.gif create mode 100644 src/TF_Themes/SkyBlue/TF_SkyBlue.css create mode 100644 src/TF_Themes/SkyBlue/images/bg_skyblue.gif create mode 100644 src/TF_Themes/SkyBlue/images/btn_first_page.gif create mode 100644 src/TF_Themes/SkyBlue/images/btn_last_page.gif create mode 100644 src/TF_Themes/SkyBlue/images/btn_next_page.gif create mode 100644 src/TF_Themes/SkyBlue/images/btn_prev_page.gif create mode 100644 src/TF_Themes/SkyBlue/images/icn_clear_filters.png create mode 100644 src/TF_Themes/SkyBlue/images/img_loading.gif create mode 100644 src/TF_Themes/blank.png create mode 100644 src/TF_Themes/btn_clear_filters.png create mode 100644 src/TF_Themes/btn_filter.png create mode 100644 src/TF_Themes/btn_first_page.gif create mode 100644 src/TF_Themes/btn_last_page.gif create mode 100644 src/TF_Themes/btn_next_page.gif create mode 100644 src/TF_Themes/btn_previous_page.gif create mode 100644 src/TF_Themes/downsimple.png create mode 100644 src/TF_Themes/icn_filter.gif create mode 100644 src/TF_Themes/icn_filterActive.gif create mode 100644 src/TF_Themes/upsimple.png create mode 100644 src/filtergrid.css create mode 100644 src/tablefilter.js create mode 100644 src/tablefilter_all.js diff --git a/.gitignore b/.gitignore index e8e6ce6e..c3865977 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ # Dependency directory -node_modules \ No newline at end of file +node_modules +npm-debug.log \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 00000000..fdbb66e0 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,99 @@ +module.exports = function (grunt) { + // Initializes the Grunt tasks with the following settings + grunt.initConfig({ + + pkg: grunt.file.readJSON('package.json'), + + version: 'v1.0', + dist_folder: 'dist/', + source_folder: 'src/', + + // A list of files, which will be syntax-checked by JSHint + jshint: { + src: ['Gruntfile.js', /*'<%= source_folder %>tablefilter_all.js'*/], + options: { + '-W069': true, // ['xxx'] is better written in dot notation + '-W099': true, // Mixed spaces and tabs + '-W004': true, // 'i' is already defined + '-W014': true, // Bad line breaking before '&&' + '-W083': true, // Don't make functions within a loop + '-W086': true, // Expected a 'break' statement before 'default' + '-W049': true, // Unexpected escaped character '<' in regular expression + '-W100': true, // This character may get silently deleted by one or more browsers + '-W041': true + } + }, + + concat: { + js: { + files: [{ + src: ['<%= source_folder %>tablefilter_all.js'], + dest: '<%= dist_folder %>tablefilter_all.js' + }] + }, + css: { + files: [{ + src: ['<%= source_folder %>filtergrid.css'], + dest: '<%= dist_folder %>filtergrid.css' + }] + } + }, + + // and minified (source and destination files) + uglify: { + + options: { + banner: '/*------------------------------------------------------------------------ \n' + + '\t- TableFilter <%= version %> by Max Guglielmi \n' + + '\t- build date: <%= grunt.template.today() %> \n' + + '\t- http://tablefilter.free.fr \n' + + '\t- Copyright (c) 2014, Licensed under the MIT License \n' + + '------------------------------------------------------------------------*/ \n' + }, + + js: { + src: ['<%= concat.js.files[0].dest %>'], + dest: '<%= concat.js.files[0].dest %>' + } + }, + + cssmin: { + combine: { + options: { + banner: '/*------------------------------------------------------------------------ \n' + + '\t- TableFilter stylesheet by Max Guglielmi \n' + + '\t- (build date: <%= grunt.template.today() %>) \n' + + '\t- Edit below for your projects\' needs \n' + + '------------------------------------------------------------------------*/ \n' + }, + files: { + '<%= concat.css.files[0].dest %>': ['<%= concat.css.files[0].dest %>'] + } + } + }, + + copy: { + main: { + files: [ + { src: ['<%= source_folder %>tablefilter_all.js'], dest: '<%= dist_folder %>tablefilter_all-uncompressed.js' }, + { src: ['<%= source_folder %>tablefilter.js'], dest: '<%= dist_folder %>tablefilter-uncompressed.js' }, + { src: ['<%= source_folder %>filtergrid.css'], dest: '<%= dist_folder %>filtergrid-uncompressed.css' }, + { src: ['**'], cwd: '<%= source_folder %>TF_Modules/', dest: '<%= dist_folder %>TF_Modules/', expand: true }, + { src: ['**'], cwd: '<%= source_folder %>TF_Themes/', dest: '<%= dist_folder %>TF_Themes/', expand: true } + ] + } + } + }); + + // Load the plugins that provide the tasks we specified in package.json. + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-contrib-copy'); + + // This is the default task being executed if Grunt + // is called without any further parameter. + grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'cssmin', 'copy']); + +}; \ No newline at end of file diff --git a/dist/TF_Modules/tf_alternateRows.js b/dist/TF_Modules/tf_alternateRows.js new file mode 100644 index 00000000..2e40da77 --- /dev/null +++ b/dist/TF_Modules/tf_alternateRows.js @@ -0,0 +1,71 @@ +/*------------------------------------------------------------------------ + - HTML Table Filter Generator + - Alternating rows color feature v1.0 + - By Max Guglielmi (tablefilter.free.fr) + - Licensed under the MIT License +-------------------------------------------------------------------------*/ + +TF.prototype.SetRowBg = function(rIndex,index) +/*==================================================== + - sets row background color + - Params: + - rIndex: row index (numeric value) + - index: valid row collection index needed to + calculate bg color +=====================================================*/ +{ + if(!this.alternateBgs || isNaN(rIndex)) return; + var rows = this.tbl.rows; + var i = (index==undefined) ? rIndex : index; + this.RemoveRowBg(rIndex); + tf_AddClass( + rows[rIndex], + (i%2) ? this.rowBgEvenCssClass : this.rowBgOddCssClass + ); +} + +TF.prototype.RemoveRowBg = function(index) +/*==================================================== + - removes row background color + - Params: + - index: row index (numeric value) +=====================================================*/ +{ + if(isNaN(index)) return; + var rows = this.tbl.rows; + tf_RemoveClass(rows[index],this.rowBgOddCssClass); + tf_RemoveClass(rows[index],this.rowBgEvenCssClass); +} + +TF.prototype.SetAlternateRows = function() +/*==================================================== + - alternates row colors for better readability +=====================================================*/ +{ + if( !this.hasGrid && !this.isFirstLoad ) return; + var rows = this.tbl.rows; + var noValidRowsIndex = this.validRowsIndex==null; + var beginIndex = (noValidRowsIndex) ? this.refRow : 0; //1st index + var indexLen = (noValidRowsIndex) // nb indexes + ? (this.nbFilterableRows+beginIndex) : this.validRowsIndex.length; + + var idx = 0; + for(var j=beginIndex; jmaxValue? parseFloat( cvalue ): maxValue;} + } + } + }//for j + if (meanFlag==1) meanValue = sumValue/nbvalues; + if (medFlag==1) + { + var aux = 0; + if(nbvalues%2 == 1) + { + aux = Math.floor(nbvalues/2); + medValue = theList[aux]; + } + else medValue = (theList[nbvalues/2]+theList[((nbvalues/2)-1)])/2; + } + if (q1Flag==1) + { + var posa=0.0; + posa = Math.floor(nbvalues/4); + if (4*posa == nbvalues) {q1Value = (theList[posa-1] + theList[posa])/2;} + else {q1Value = theList[posa];} + } + if (q3Flag==1) + { + var posa=0.0; + var posb=0.0; + posa = Math.floor(nbvalues/4); + if (4*posa == nbvalues) + { + posb = 3*posa; + q3Value = (theList[posb] + theList[posb-1])/2; + } + else + q3Value = theList[nbvalues-posa-1]; + } + + for(var i=0; i<=mThisCol; i++ ) + { + switch( opsThisCol[i] ) + { + case 'mean': + result=meanValue; + break; + case 'sum': + result=sumValue; + break; + case 'min': + result=minValue; + break; + case 'max': + result=maxValue; + break; + case 'median': + result=medValue; + break; + case 'q1': + result=q1Value; + break; + case 'q3': + result=q3Value; + break; + } + + var precision = decThisCol[i]!=undefined && !isNaN( decThisCol[i] ) + ? decThisCol[i] : 2; + + if(oTypeThisCol!=null && result) + {//if outputType is defined + result = result.toFixed( precision ); + if( tf_Id( labThisCol[i] )!=undefined ) + { + switch( oTypeThisCol.tf_LCase() ) + { + case 'innerhtml': + if (isNaN(result) || !isFinite(result) || (nbvalues==0)) + tf_Id( labThisCol[i] ).innerHTML = '.'; + else + tf_Id( labThisCol[i] ).innerHTML = result; + break; + case 'setvalue': + tf_Id( labThisCol[i] ).value = result; + break; + case 'createtextnode': + var oldnode = tf_Id( labThisCol[i] ).firstChild; + var txtnode = tf_CreateText( result ); + tf_Id( labThisCol[i] ).replaceChild( txtnode,oldnode ); + break; + }//switch + } + } else { + try + { + if (isNaN(result) || !isFinite(result) || (nbvalues==0)) + tf_Id( labThisCol[i] ).innerHTML = '.'; + else + tf_Id( labThisCol[i] ).innerHTML = result.toFixed( precision ); + } catch(e){ }//catch + }//else + }//for i + //eventual row(s) with result are always visible + if(totRowIndex!=undefined && row[totRowIndex[ucol]]) + row[totRowIndex[ucol]].style.display = ''; + }//for ucol + }//if typeof + + if(this.onAfterOperation) this.onAfterOperation.call(null,this); +} + diff --git a/dist/TF_Modules/tf_cookies.js b/dist/TF_Modules/tf_cookies.js new file mode 100644 index 00000000..25891993 --- /dev/null +++ b/dist/TF_Modules/tf_cookies.js @@ -0,0 +1,163 @@ +/*------------------------------------------------------------------------ + - HTML Table Filter Generator + - Remember values features (cookies) v1.1 + - By Max Guglielmi (tablefilter.free.fr) + - Licensed under the MIT License +-------------------------------------------------------------------------*/ + +TF.prototype.RememberFiltersValue = function( name ) +/*============================================== + - stores filters' values in a cookie + when Filter() method is called + - Params: + - name: cookie name (string) + - credits to Florent Hirchy +===============================================*/ +{ + var flt_values = []; + for(var i=0; i 0 && !o.ezEditTableConfig.startRow) startRow = undefined; + //otherwise startRow config property if any or TableFilter refRow + else startRow = o.ezEditTableConfig.startRow || o.refRow; + + //Enables scroll into view feature if not defined + o.ezEditTableConfig.scroll_into_view = o.ezEditTableConfig.scroll_into_view!=undefined ? o.ezEditTableConfig.scroll_into_view : true; + o.ezEditTableConfig.base_path = o.ezEditTableConfig.base_path!=undefined ? o.ezEditTableConfig.base_path : o.basePath + 'ezEditTable/'; + o.ezEditTableConfig.editable = o.editable; + o.ezEditTableConfig.selection = o.selectable; + if(o.selectable) + o.ezEditTableConfig.default_selection = o.ezEditTableConfig.default_selection!=undefined ? o.ezEditTableConfig.default_selection : 'row'; + //CSS Styles + o.ezEditTableConfig.active_cell_css = o.ezEditTableConfig.active_cell_css!=undefined ? o.ezEditTableConfig.active_cell_css : 'ezETSelectedCell'; + + o._lastValidRowIndex = 0; + o._lastRowIndex = 0; + + if(o.selectable){ + //Row navigation needs to be calculated according to TableFilter's validRowsIndex array + function onAfterSelection(et, selecteElm, e){ + if(!o.validRowsIndex) return; //table is not filtered + var row = et.defaultSelection != 'row' ? selecteElm.parentNode : selecteElm; + var cell = selecteElm.nodeName=='TD' ? selecteElm : null; //cell for default_selection = 'both' or 'cell' + var keyCode = e != undefined ? et.Event.GetKey(e) : 0; + var isRowValid = o.validRowsIndex.tf_Has(row.rowIndex); + var nextRowIndex; + var d = (keyCode == 34 || keyCode == 33 ? (o.pagingLength || et.nbRowsPerPage) : 1); //pgup/pgdown keys + + //If next row is not valid, next valid filtered row needs to be calculated + if(!isRowValid){ + //Selection direction up/down + if(row.rowIndex>o._lastRowIndex){ + if(row.rowIndex >= o.validRowsIndex[o.validRowsIndex.length-1]) //last row + nextRowIndex = o.validRowsIndex[o.validRowsIndex.length-1]; + else{ + var calcRowIndex = (o._lastValidRowIndex + d); + if(calcRowIndex > (o.validRowsIndex.length-1)) + nextRowIndex = o.validRowsIndex[o.validRowsIndex.length-1]; + else nextRowIndex = o.validRowsIndex[calcRowIndex]; + } + } else{ + if(row.rowIndex < o.validRowsIndex[0]) nextRowIndex = o.validRowsIndex[0];//first row + else{ + var v = o.validRowsIndex[o._lastValidRowIndex - d]; + nextRowIndex = v ? v : o.validRowsIndex[0]; + } + } + o._lastRowIndex = row.rowIndex; + DoSelection(nextRowIndex); + } else{ + //If filtered row is valid, special calculation for pgup/pgdown keys + if(keyCode!=34 && keyCode!=33){ + o._lastValidRowIndex = o.validRowsIndex.tf_IndexByValue(row.rowIndex); + o._lastRowIndex = row.rowIndex; + } else { + if(keyCode == 34){ //pgdown + if((o._lastValidRowIndex + d) <= (o.validRowsIndex.length-1)) //last row + nextRowIndex = o.validRowsIndex[o._lastValidRowIndex + d]; + else nextRowIndex = o.validRowsIndex[o.validRowsIndex.length-1]; + } else { //pgup + if((o._lastValidRowIndex - d) < (o.validRowsIndex[0])) //first row + nextRowIndex = o.validRowsIndex[0]; + else nextRowIndex = o.validRowsIndex[o._lastValidRowIndex - d]; + } + o._lastRowIndex = nextRowIndex; + o._lastValidRowIndex = o.validRowsIndex.tf_IndexByValue(nextRowIndex); + DoSelection(nextRowIndex); + } + } + + //Next valid filtered row needs to be selected + function DoSelection(nextRowIndex){ + if(et.defaultSelection == 'row'){ + et.Selection.SelectRowByIndex(nextRowIndex); + } else { + et.ClearSelections(); + var cellIndex = selecteElm.cellIndex; + var row = o.tbl.rows[nextRowIndex]; + if(et.defaultSelection == 'both') et.Selection.SelectRowByIndex(nextRowIndex); + if(row) et.Selection.SelectCell(row.cells[cellIndex]); + } + //Table is filtered + if(o.validRowsIndex.length != o.GetRowsNb()){ + var row = o.tbl.rows[nextRowIndex]; + if(row) row.scrollIntoView(false); + if(cell){ + if(cell.cellIndex==(o.GetCellsNb()-1) && o.gridLayout) o.tblCont.scrollLeft = 100000000; + else if(cell.cellIndex==0 && o.gridLayout) o.tblCont.scrollLeft = 0; + else cell.scrollIntoView(false); + } + } + } + } + + //Page navigation has to be enforced whenever selected row is out of the current page range + function onBeforeSelection(et, selecteElm, e){ + var row = et.defaultSelection != 'row' ? selecteElm.parentNode : selecteElm; + if(o.paging){ + if(o.nbPages>1){ + et.nbRowsPerPage = o.pagingLength; //page length is re-assigned in case it has changed + var pagingEndRow = parseInt(o.startPagingRow) + parseInt(o.pagingLength); + var rowIndex = row.rowIndex; + if((rowIndex == o.validRowsIndex[o.validRowsIndex.length-1]) && o.currentPageNb!=o.nbPages) o.SetPage('last'); + else if((rowIndex == o.validRowsIndex[0]) && o.currentPageNb!=1) o.SetPage('first'); + else if(rowIndex > o.validRowsIndex[pagingEndRow-1] && rowIndex < o.validRowsIndex[o.validRowsIndex.length-1]) o.SetPage('next'); + else if(rowIndex < o.validRowsIndex[o.startPagingRow] && rowIndex > o.validRowsIndex[0]) o.SetPage('previous'); + } + } + } + + //Selected row needs to be visible when paging is activated + if(o.paging){ + o.onAfterChangePage = function(tf, i){ + var row = tf.ezEditTable.Selection.GetActiveRow(); + if(row) row.scrollIntoView(false); + var cell = tf.ezEditTable.Selection.GetActiveCell(); + if(cell) cell.scrollIntoView(false); + } + } + + //Rows navigation when rows are filtered is performed with the EditTable row selection callback events + if(o.ezEditTableConfig.default_selection=='row'){ + var fnB = o.ezEditTableConfig.on_before_selected_row; + o.ezEditTableConfig.on_before_selected_row = function(){ + onBeforeSelection(arguments[0], arguments[1], arguments[2]); + if(fnB) fnB.call(null, arguments[0], arguments[1], arguments[2]); + }; + var fnA = o.ezEditTableConfig.on_after_selected_row; + o.ezEditTableConfig.on_after_selected_row = function(){ + onAfterSelection(arguments[0], arguments[1], arguments[2]); + if(fnA) fnA.call(null, arguments[0], arguments[1], arguments[2]); + }; + } else { + var fnB = o.ezEditTableConfig.on_before_selected_cell; + o.ezEditTableConfig.on_before_selected_cell = function(){ + onBeforeSelection(arguments[0], arguments[1], arguments[2]); + if(fnB) fnB.call(null, arguments[0], arguments[1], arguments[2]); + }; + var fnA = o.ezEditTableConfig.on_after_selected_cell; + o.ezEditTableConfig.on_after_selected_cell = function(){ + onAfterSelection(arguments[0], arguments[1], arguments[2]); + if(fnA) fnA.call(null, arguments[0], arguments[1], arguments[2]); + }; + } + } + if(o.editable){ + //Added or removed rows, TF rows number needs to be re-calculated + var fnC = o.ezEditTableConfig.on_added_dom_row; + o.ezEditTableConfig.on_added_dom_row = function(){ + o.nbFilterableRows++; + if(!o.paging){ o.RefreshNbRows(); } + else { + o.nbRows++; o.nbVisibleRows++; o.nbFilterableRows++; + o.paging=false; o.RemovePaging(); o.AddPaging(false); + } + if(o.alternateBgs) o.SetAlternateRows(); + if(fnC) fnC.call(null, arguments[0], arguments[1], arguments[2]); + }; + if(o.ezEditTableConfig.actions && o.ezEditTableConfig.actions['delete']){ + var fnD = o.ezEditTableConfig.actions['delete'].on_after_submit; + o.ezEditTableConfig.actions['delete'].on_after_submit = function(){ + o.nbFilterableRows--; + if(!o.paging){ o.RefreshNbRows(); } + else { + o.nbRows--; o.nbVisibleRows--; o.nbFilterableRows--; + o.paging=false; o.RemovePaging(); o.AddPaging(false); + } + if(o.alternateBgs) o.SetAlternateRows(); + if(fnD) fnD.call(null, arguments[0], arguments[1]); + } + } + } + + try{ + o.ezEditTable = new EditTable(o.id, o.ezEditTableConfig, startRow); + o.ezEditTable.Init(); + } catch(e) { alert(o.ezEditTableConfig.err); } +} \ No newline at end of file diff --git a/dist/TF_Modules/tf_fixedHeaders.js b/dist/TF_Modules/tf_fixedHeaders.js new file mode 100644 index 00000000..2ab4659d --- /dev/null +++ b/dist/TF_Modules/tf_fixedHeaders.js @@ -0,0 +1,95 @@ +/*------------------------------------------------------------------------ + - HTML Table Filter Generator + - Fixed headers feature v1.0 - Deprecated! + - By Max Guglielmi (tablefilter.free.fr) + - Licensed under the MIT License +-------------------------------------------------------------------------*/ + +TF.prototype.SetFixedHeaders = function() +/*==================================================== + - CSS solution making headers fixed +=====================================================*/ +{ + if((!this.hasGrid && !this.isFirstLoad) || !this.fixedHeaders) return; + if(this.contDiv) return; + var thead = tf_Tag(this.tbl,'thead'); + if( thead.length==0 ) return; + var tbody = tf_Tag(this.tbl,'tbody'); + if( tbody[0].clientHeight!=0 ) + {//firefox returns tbody height + //previous values + this.prevTBodyH = tbody[0].clientHeight; + this.prevTBodyOverflow = tbody[0].style.overflow; + this.prevTBodyOverflowX = tbody[0].style.overflowX; + + tbody[0].style.height = this.tBodyH+'px'; + tbody[0].style.overflow = 'auto'; + tbody[0].style.overflowX = 'hidden'; + } else { //IE returns 0 + // cont div is added to emulate fixed headers behaviour + var contDiv = tf_CreateElm( 'div',['id',this.prfxContentDiv+this.id] ); + contDiv.className = this.contDivCssClass; + this.tbl.parentNode.insertBefore(contDiv, this.tbl); + contDiv.appendChild(this.tbl); + this.contDiv = tf_Id(this.prfxContentDiv+this.id); + //prevents headers moving during window scroll (IE) + this.contDiv.style.position = 'relative'; + + var theadH = 0; + var theadTr = tf_Tag(thead[0],'tr'); + for(var i=0; i= ' + + 'offsetParent.offsetHeight ? 0 - parentNode.parentNode.offsetHeight + '+ + 'offsetParent.offsetHeight + offsetParent.scrollTop : 0);'; + } +} + +TF.prototype.RemoveFixedHeaders = function() +/*==================================================== + - Removes fixed headers +=====================================================*/ +{ + if(!this.hasGrid || !this.fixedHeaders ) return; + if( this.contDiv )//IE additional div + { + this.contDiv.parentNode.insertBefore(this.tbl, this.contDiv); + this.contDiv.parentNode.removeChild( this.contDiv ); + this.contDiv = null; + var thead = tf_Tag(this.tbl,'thead'); + if( thead.length==0 ) return; + var theadTr = tf_Tag(thead[0],'tr'); + if( theadTr.length==0 ) return; + for(var i=0; i0 ) this.tbl.removeChild(thead[0]); + + //Headers table style + this.headTbl.style.width = this.tbl.style.width; + this.headTbl.style.tableLayout = 'fixed'; + this.tbl.style.tableLayout = 'fixed'; + this.headTbl.cellPadding = this.tbl.cellPadding; + this.headTbl.cellSpacing = this.tbl.cellSpacing; + + //Headers container width + this.headTblCont.style.width = this.tblCont.clientWidth+'px'; + + //content table without headers needs col widths to be reset + this.SetColWidths(); + + this.tbl.style.width = ''; + if(tf_isIE || tf_isIE7) this.headTbl.style.width = ''; + + //scroll synchronisation + var o = this; //TF object + this.tblCont.onscroll = function(){ + o.headTblCont.scrollLeft = this.scrollLeft; + var _o = this; //this = scroll element + //New pointerX calc taking into account scrollLeft + if(!o.isPointerXOverwritten){ + try{ + TF.Evt.pointerX = function(e) + { + e = e || window.event; + var scrollLeft = tf_StandardBody().scrollLeft + _o.scrollLeft; + return (e.pageX + _o.scrollLeft) || (e.clientX + scrollLeft); + } + o.isPointerXOverwritten = true; + } catch(ee) { + o.isPointerXOverwritten = false; + } + } + } + + /*** Default behaviours activation ***/ + var f = this.fObj==undefined ? {} : this.fObj; + + //Sort is enabled if not specified in config object + if(f.sort != false){ + this.sort = true; + this.sortConfig.asyncSort = true; + this.sortConfig.triggerIds = sortTriggers; + } + + if(this.gridEnableColResizer){ + if(!this.hasExtensions){ + this.extensions = { + name:['ColumnsResizer_'+this.id], + src:[this.gridColResizerPath], + description:['Columns Resizing'], + initialize:[function(o){ o.SetColsResizer('ColumnsResizer_'+o.id); }] + } + this.hasExtensions = true; + } else { + if(!this.__containsStr('colsresizer',this.extensions.src.toString().tf_LCase())){ + this.extensions.name.push('ColumnsResizer_'+this.id); + this.extensions.src.push(this.gridColResizerPath); + this.extensions.description.push('Columns Resizing'); + this.extensions.initialize.push(function(o){o.SetColsResizer('ColumnsResizer_'+o.id);}); + } + } + } + + //Default columns resizer properties for grid layout + f.col_resizer_cols_headers_table = this.headTbl.getAttribute('id'); + f.col_resizer_cols_headers_index = this.gridHeadRowIndex; + f.col_resizer_width_adjustment = 0; + f.col_enable_text_ellipsis = false; + + //Cols generation for all browsers excepted IE<=7 + o.tblHasColTag = (tf_Tag(o.tbl,'col').length > 0) ? true : false; + if(!tf_isIE && !tf_isIE7){ + //Col elements are enough to keep column widths after sorting and filtering + function createColTags(o) + { + if(!o) return; + for(var k=(o.nbCells-1); k>=0; k--) + { + var col = tf_CreateElm( 'col', ['id', o.id+'_col_'+k]); + o.tbl.firstChild.parentNode.insertBefore(col,o.tbl.firstChild); + col.style.width = o.colWidth[k]; + o.gridColElms[k] = col; + } + o.tblHasColTag = true; + } + if(!o.tblHasColTag) createColTags(o); + else{ + var cols = tf_Tag(o.tbl,'col'); + for(var i=0; i0 ) r = tbody[0].insertRow(0); + else r = o.tbl.insertRow(0); + r.style.height = '0px'; + for(var i=0; i0 ) + tbody[0].moveRow(o.leadColWidthsRow.rowIndex, 0); + else o.tbl.moveRow(o.leadColWidthsRow.rowIndex, 0); + } + if(afterSortFn!=null) afterSortFn.call(null,o,colIndex); + } + } + + var afterColResizedFn = tf_IsFn(f.on_after_col_resized) ? f.on_after_col_resized : null; + f.on_after_col_resized = function(o,colIndex){ + if(colIndex==undefined) return; + var w = o.crWColsRow.cells[colIndex].style.width; + var col = o.gridColElms[colIndex]; + col.style.width = w; + + var thCW = o.crWColsRow.cells[colIndex].clientWidth; + var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth; + + if(tf_isIE || tf_isIE7) + o.tbl.style.width = o.headTbl.clientWidth+'px'; + + if(thCW != tdCW && !tf_isIE && !tf_isIE7) + o.headTbl.style.width = o.tbl.clientWidth+'px'; + + if(afterColResizedFn!=null) afterColResizedFn.call(null,o,colIndex); + } + + if(this.tbl.clientWidth != this.headTbl.clientWidth) + this.tbl.style.width = this.headTbl.clientWidth+'px'; + +} + +TF.prototype.RemoveGridLayout = function() +/*==================================================== + - removes the grid layout +=====================================================*/ +{ + if(!this.gridLayout) return; + var t = this.tbl.parentNode.removeChild(this.tbl); + this.tblMainCont.parentNode.insertBefore(t, this.tblMainCont); + this.tblMainCont.parentNode.removeChild( this.tblMainCont ); + + this.tblMainCont = null; + this.headTblCont = null; + this.headTbl = null; + this.tblCont = null; + + this.tbl.outerHTML = this.sourceTblHtml; + this.tbl = tf_Id(this.id); //needed to keep reference +} \ No newline at end of file diff --git a/dist/TF_Modules/tf_highlightKeywords.js b/dist/TF_Modules/tf_highlightKeywords.js new file mode 100644 index 00000000..4d59c6ac --- /dev/null +++ b/dist/TF_Modules/tf_highlightKeywords.js @@ -0,0 +1,97 @@ +/*------------------------------------------------------------------------ + - HTML Table Filter Generator + - Highlight keywords feature v1.2 + - By Max Guglielmi (tablefilter.free.fr) + - Licensed under the MIT License +-------------------------------------------------------------------------*/ + +TF.prototype.UnhighlightAll = function() +/*==================================================== + - removes keyword highlighting +=====================================================*/ +{ + if( this.highlightKeywords && this.searchArgs!=null ){ + for(var y=0; y'; //defines next page button text + this.btnPrevPageText = f.btn_prev_page_text!=undefined + ? f.btn_prev_page_text : '<'; //defines previous page button text + this.btnLastPageText = f.btn_last_page_text!=undefined + ? f.btn_last_page_text : '>|'; //defines last page button text + this.btnFirstPageText = f.btn_first_page_text!=undefined + ? f.btn_first_page_text : '|<' ; //defines first page button text + this.btnNextPageHtml = f.btn_next_page_html!=undefined //defines next page button html + ? f.btn_next_page_html : (!this.enableIcons ? null : + ''); + this.btnPrevPageHtml = f.btn_prev_page_html!=undefined //defines previous page button html + ? f.btn_prev_page_html : (!this.enableIcons ? null : + ''); + this.btnFirstPageHtml = f.btn_first_page_html!=undefined //defines last page button html + ? f.btn_first_page_html : (!this.enableIcons ? null : + ''); + this.btnLastPageHtml = f.btn_last_page_html!=undefined //defines previous page button html + ? f.btn_last_page_html : (!this.enableIcons ? null : + ''); + this.pageText = f.page_text!=undefined ? f.page_text : ' Page '; //defines text preceeding page selector drop-down + this.ofText = f.of_text!=undefined ? f.of_text : ' of '; //defines text after page selector drop-down + this.nbPgSpanCssClass = f.nb_pages_css_class!=undefined ? f.nb_pages_css_class :'nbpg'; //css class for span containing tot nb of pages + this.hasPagingBtns = f.paging_btns==false ? false : true; //enables/disables paging buttons + this.pagingBtnEvents = null; //stores paging buttons events + this.pageSelectorType = f.page_selector_type!=undefined + ? f.page_selector_type : this.fltTypeSlc; //defines previous page button html + this.onBeforeChangePage = tf_IsFn(f.on_before_change_page) ? f.on_before_change_page : null; //calls function before page is changed + this.onAfterChangePage = tf_IsFn(f.on_after_change_page) ? f.on_after_change_page : null; //calls function before page is changed + + var start_row = this.refRow; + var nrows = this.nbRows; + this.nbPages = Math.ceil( (nrows-start_row)/this.pagingLength );//calculates page nb + + //Paging elements events + if(!this.Evt._Paging.next) + { + var o = this; + this.Evt._Paging = {// paging buttons events + slcIndex: function(){ + return (o.pageSelectorType==o.fltTypeSlc) + ? o.pagingSlc.options.selectedIndex + : parseInt(o.pagingSlc.value)-1; + }, + nbOpts: function(){ + return (o.pageSelectorType==o.fltTypeSlc) + ? parseInt(o.pagingSlc.options.length)-1 + : (o.nbPages-1); + }, + next: function(){ + if(o.Evt._Paging.nextEvt) o.Evt._Paging.nextEvt(); + var nextIndex = (o.Evt._Paging.slcIndex()0 + ? o.Evt._Paging.slcIndex()-1 : o.Evt._Paging.nbOpts(); + o.ChangePage(prevIndex); + }, + last: function(){ + if(o.Evt._Paging.lastEvt) o.Evt._Paging.lastEvt(); + o.ChangePage(o.Evt._Paging.nbOpts()); + }, + first: function(){ + if(o.Evt._Paging.firstEvt) o.Evt._Paging.firstEvt(); + o.ChangePage(0); + }, + _detectKey: function(e) + { + var evt=(e)?e:(window.event)?window.event:null; + if(evt) + { + var key=(evt.charCode)?evt.charCode: + ((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0)); + if(key=='13'){ + if(o.sorted){ o.Filter(); o.ChangePage(o.Evt._Paging.slcIndex()); } + else o.ChangePage(); + this.blur(); + } + }//if evt + }, + nextEvt: null, + prevEvt: null, + lastEvt: null, + firstEvt: null + } + } + + if(!this.Evt._OnSlcPagesChange) + { + this.Evt._OnSlcPagesChange = function() + /*==================================================== + - onchange event for paging select + =====================================================*/ + { + if(o.Evt._Paging._OnSlcPagesChangeEvt) + o.Evt._Paging._OnSlcPagesChangeEvt(); + o.ChangePage(); + this.blur(); + //ie only: blur is not enough... + if(this.parentNode && tf_isIE) + this.parentNode.focus(); + } + } + + // Paging drop-down list selector + if(this.pageSelectorType == this.fltTypeSlc) + { + var slcPages = tf_CreateElm( this.fltTypeSlc, ['id',this.prfxSlcPages+this.id] ); + slcPages.className = this.pgSlcCssClass; + slcPages.onchange = this.Evt._OnSlcPagesChange; + } + // Paging input selector + if(this.pageSelectorType == this.fltTypeInp) + { + var slcPages = tf_CreateElm( + this.fltTypeInp, + ['id',this.prfxSlcPages+this.id], + ['value',this.currentPageNb] + ); + slcPages.className = this.pgInpCssClass; + slcPages.onkeypress = this.Evt._Paging._detectKey; + } + + var btnNextSpan, btnPrevSpan, btnLastSpan, btnFirstSpan;// btns containers + btnNextSpan = tf_CreateElm('span',['id',this.prfxBtnNextSpan+this.id]); + btnPrevSpan = tf_CreateElm('span',['id',this.prfxBtnPrevSpan+this.id]); + btnLastSpan = tf_CreateElm('span',['id',this.prfxBtnLastSpan+this.id]); + btnFirstSpan = tf_CreateElm('span',['id',this.prfxBtnFirstSpan+this.id]); + + if(this.hasPagingBtns) + { + if(this.btnNextPageHtml==null) + {// Next button + var btn_next = tf_CreateElm( this.fltTypeInp,['id',this.prfxBtnNext+this.id], + ['type','button'],['value',this.btnNextPageText],['title','Next'] ); + btn_next.className = this.btnPageCssClass; + btn_next.onclick = this.Evt._Paging.next; + btnNextSpan.appendChild(btn_next); + } else { + btnNextSpan.innerHTML = this.btnNextPageHtml; + btnNextSpan.onclick = this.Evt._Paging.next; + } + + if(this.btnPrevPageHtml==null) + {// Previous button + var btn_prev = tf_CreateElm( this.fltTypeInp,['id',this.prfxBtnPrev+this.id], + ['type','button'],['value',this.btnPrevPageText],['title','Previous'] ); + btn_prev.className = this.btnPageCssClass; + btn_prev.onclick = this.Evt._Paging.prev; + btnPrevSpan.appendChild(btn_prev); + } else { + btnPrevSpan.innerHTML = this.btnPrevPageHtml; + btnPrevSpan.onclick = this.Evt._Paging.prev; + } + + if(this.btnLastPageHtml==null) + {// Last button + var btn_last = tf_CreateElm( this.fltTypeInp,['id',this.prfxBtnLast+this.id], + ['type','button'],['value',this.btnLastPageText],['title','Last'] ); + btn_last.className = this.btnPageCssClass; + btn_last.onclick = this.Evt._Paging.last; + btnLastSpan.appendChild(btn_last); + } else { + btnLastSpan.innerHTML = this.btnLastPageHtml; + btnLastSpan.onclick = this.Evt._Paging.last; + } + + if(this.btnFirstPageHtml==null) + {// First button + var btn_first = tf_CreateElm( this.fltTypeInp,['id',this.prfxBtnFirst+this.id], + ['type','button'],['value',this.btnFirstPageText],['title','First'] ); + btn_first.className = this.btnPageCssClass; + btn_first.onclick = this.Evt._Paging.first; + btnFirstSpan.appendChild(btn_first); + } else { + btnFirstSpan.innerHTML = this.btnFirstPageHtml; + btnFirstSpan.onclick = this.Evt._Paging.first; + } + }//if this.hasPagingBtns + + // paging elements (buttons+drop-down list) are added to defined element + if(this.pagingTgtId==null) this.SetTopDiv(); + var targetEl = ( this.pagingTgtId==null ) ? this.mDiv : tf_Id( this.pagingTgtId ); + + /*** if paging previously removed this prevents IE memory leak with removeChild + used in RemovePaging method. For more info refer to + http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2840253&SiteID=1 ***/ + if ( targetEl.innerHTML!='' ) targetEl.innerHTML = ''; + /*** ***/ + + targetEl.appendChild(btnFirstSpan); + targetEl.appendChild(btnPrevSpan); + + var pgBeforeSpan = tf_CreateElm( 'span',['id',this.prfxPgBeforeSpan+this.id] ); + pgBeforeSpan.appendChild( tf_CreateText(this.pageText) ); + pgBeforeSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgBeforeSpan); + targetEl.appendChild(slcPages); + var pgAfterSpan = tf_CreateElm( 'span',['id',this.prfxPgAfterSpan+this.id] ); + pgAfterSpan.appendChild( tf_CreateText(this.ofText) ); + pgAfterSpan.className = this.nbPgSpanCssClass; + targetEl.appendChild(pgAfterSpan) + var pgspan = tf_CreateElm( 'span',['id',this.prfxPgSpan+this.id] ); + pgspan.className = this.nbPgSpanCssClass; + pgspan.appendChild( tf_CreateText(' '+this.nbPages+' ') ); + targetEl.appendChild(pgspan); + targetEl.appendChild(btnNextSpan); + targetEl.appendChild(btnLastSpan); + this.pagingSlc = tf_Id(this.prfxSlcPages+this.id); //to be easily re-used + + // if this.rememberGridValues==true this.SetPagingInfo() is called + // in ResetGridValues() method + if( !this.rememberGridValues || this.isPagingRemoved ) + this.SetPagingInfo(); + if( !this.fltGrid ) + { + this.ValidateAllRows(); + this.SetPagingInfo(this.validRowsIndex); + } + + this.pagingBtnEvents = this.Evt._Paging; + this.isPagingRemoved = false; +} + +TF.prototype.RemovePaging = function() +/*==================================================== + - Removes paging elements +=====================================================*/ +{ + if(!this.hasGrid) return; + if( this.pagingSlc==null ) return; + var btnNextSpan, btnPrevSpan, btnLastSpan, btnFirstSpan;// btns containers + var pgBeforeSpan, pgAfterSpan, pgspan; + btnNextSpan = tf_Id(this.prfxBtnNextSpan+this.id); + btnPrevSpan = tf_Id(this.prfxBtnPrevSpan+this.id); + btnLastSpan = tf_Id(this.prfxBtnLastSpan+this.id); + btnFirstSpan = tf_Id(this.prfxBtnFirstSpan+this.id); + pgBeforeSpan = tf_Id(this.prfxPgBeforeSpan+this.id);//span containing 'Page' text + pgAfterSpan = tf_Id(this.prfxPgAfterSpan+this.id);//span containing 'of' text + pgspan = tf_Id(this.prfxPgSpan+this.id);//span containing nb of pages + + this.pagingSlc.parentNode.removeChild(this.pagingSlc); + + if( btnNextSpan!=null ) + btnNextSpan.parentNode.removeChild( btnNextSpan ); + + if( btnPrevSpan!=null ) + btnPrevSpan.parentNode.removeChild( btnPrevSpan ); + + if( btnLastSpan!=null ) + btnLastSpan.parentNode.removeChild( btnLastSpan ); + + if( btnFirstSpan!=null ) + btnFirstSpan.parentNode.removeChild( btnFirstSpan ); + + if( pgBeforeSpan!=null ) + pgBeforeSpan.parentNode.removeChild( pgBeforeSpan ); + + if( pgAfterSpan!=null ) + pgAfterSpan.parentNode.removeChild( pgAfterSpan ); + + if( pgspan!=null ) + pgspan.parentNode.removeChild( pgspan ); + + this.pagingBtnEvents = null; + this.pagingSlc = null; + this.isPagingRemoved = true; +} + +TF.prototype.SetPagingInfo = function( validRows ) +/*==================================================== + - calculates page # according to valid rows + - refreshes paging select according to page # + - Calls GroupByPage method +=====================================================*/ +{ + var row = this.tbl.rows; + var mdiv = ( this.pagingTgtId==null ) ? this.mDiv : tf_Id( this.pagingTgtId ); + var pgspan = tf_Id(this.prfxPgSpan+this.id); + + if( validRows!=undefined ) this.validRowsIndex = validRows;//stores valid rows index + else + { + this.validRowsIndex = [];//re-sets valid rows index + + for(var j=this.refRow; j0 ) + { + mdiv.style.visibility = 'visible'; + if(this.pageSelectorType==this.fltTypeSlc) + for(var z=0; z