From 1f4ba5f8644209a2c4e523487a0c71a4ef0bfd5f Mon Sep 17 00:00:00 2001 From: Mike Okner Date: Fri, 6 Feb 2015 14:40:10 -0600 Subject: [PATCH 1/2] Adding pixelHeight option and bumping version --- README.md | 2 +- demo/fixed.html | 6 +++--- demo/horizontal.html | 6 +++--- demo/index.html | 6 +++--- ...leBody-1.0.0.js => jquery.scrollTableBody-1.0.1.js} | 10 ++++++++-- 5 files changed, 18 insertions(+), 12 deletions(-) rename src/{jquery.scrollTableBody-1.0.0.js => jquery.scrollTableBody-1.0.1.js} (94%) diff --git a/README.md b/README.md index 1170269..a6188a2 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Usage 3. Load the Scroll Table Body plugin 4. Make sure you have a table with proper markup (``, ``, and `` if you want it) 5. Call `.scrollTableBody()` on your table element, which by default displays 10 rows of your table and scrolls the rest -6. Optional: pass `rowsToDisplay` as an option. For example, `$('table').scrollTableBody({rowsToDisplay:5});` +6. Optional: pass `rowsToDisplay` or `pixelHeight` as an option. For example, `$('table').scrollTableBody({rowsToDisplay: 5});` or `$('table').scrollTableBody({pixelHeight: 200});` Example ------- diff --git a/demo/fixed.html b/demo/fixed.html index cb206ec..7381aef 100644 --- a/demo/fixed.html +++ b/demo/fixed.html @@ -11,7 +11,7 @@ - + @@ -27,7 +27,7 @@

Usage

  • Load the Scroll Table Body plugin
  • Make sure you have a table with proper markup (<thead>, <tbody>, and <tfoot> if you want it)
  • Call .scrollTableBody() on your table element, which by default displays 10 rows of your table and scrolls the rest
  • -
  • Optional: pass rowsToDisplay as an option. For example, $('table').scrollTableBody({rowsToDisplay:5});
  • +
  • Optional: pass rowsToDisplay or pixelHeight as an option. For example, $('table').scrollTableBody({rowsToDisplay:5}); or $('table').scrollTableBody({pixelHeight: 200});
  • Fixed Width Demo

    @@ -135,4 +135,4 @@

    Fixed Width Demo

    }); - \ No newline at end of file + diff --git a/demo/horizontal.html b/demo/horizontal.html index 2bf1344..34de63d 100644 --- a/demo/horizontal.html +++ b/demo/horizontal.html @@ -12,7 +12,7 @@ - + @@ -28,7 +28,7 @@

    Usage

  • Load the Scroll Table Body plugin
  • Make sure you have a table with proper markup (<thead>, <tbody>, and <tfoot> if you want it)
  • Call .scrollTableBody() on your table element, which by default displays 10 rows of your table and scrolls the rest
  • -
  • Optional: pass rowsToDisplay as an option. For example, $('table').scrollTableBody({rowsToDisplay:5});
  • +
  • Optional: pass rowsToDisplay or pixelHeight as an option. For example, $('table').scrollTableBody({rowsToDisplay:5}); or $('table').scrollTableBody({pixelHeight: 200});
  • Horizontal Scroll Demo

    @@ -240,4 +240,4 @@

    Horizontal Scroll Demo

    }); - \ No newline at end of file + diff --git a/demo/index.html b/demo/index.html index 79cd4b4..175ce11 100644 --- a/demo/index.html +++ b/demo/index.html @@ -10,7 +10,7 @@ - + @@ -26,7 +26,7 @@

    Usage

  • Load the Scroll Table Body plugin
  • Make sure you have a table with proper markup (<thead>, <tbody>, and <tfoot> if you want it)
  • Call .scrollTableBody() on your table element, which by default displays 10 rows of your table and scrolls the rest
  • -
  • Optional: pass rowsToDisplay as an option. For example, $('table').scrollTableBody({rowsToDisplay:5});
  • +
  • Optional: pass rowsToDisplay or pixelHeight as an option. For example, $('table').scrollTableBody({rowsToDisplay:5}); or $('table').scrollTableBody({pixelHeight: 200});
  • Basic Demo

    @@ -130,4 +130,4 @@

    Basic Demo

    }); - \ No newline at end of file + diff --git a/src/jquery.scrollTableBody-1.0.0.js b/src/jquery.scrollTableBody-1.0.1.js similarity index 94% rename from src/jquery.scrollTableBody-1.0.0.js rename to src/jquery.scrollTableBody-1.0.1.js index f5bf274..14109c3 100644 --- a/src/jquery.scrollTableBody-1.0.0.js +++ b/src/jquery.scrollTableBody-1.0.1.js @@ -24,7 +24,13 @@ var existingMarginBottom = table.css('margin-bottom'); table.css('margin-bottom', 0); var rowHeight = table.find('tbody tr:first').outerHeight(); - var tableHeight = rowHeight * options.rowsToDisplay; + var tableHeight; + if (typeof options.pixelHeight !== 'undefined') { + tableHeight = options.pixelHeight; + } + else { + tableHeight = rowHeight * options.rowsToDisplay; + } var headerTable = $('
    '), footerTable = $(''), @@ -124,4 +130,4 @@ $dataTable.children('thead, tfoot').hide(); }); } -})(jQuery); \ No newline at end of file +})(jQuery); From 6365267d6177008d7e11c9c678487950b320b081 Mon Sep 17 00:00:00 2001 From: Michael Okner Date: Tue, 31 Mar 2015 17:11:53 -0500 Subject: [PATCH 2/2] Adding bower.json file --- bower.json | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 bower.json diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..3fad61d --- /dev/null +++ b/bower.json @@ -0,0 +1,29 @@ +{ + "name": "jquery.scrollTableBody", + "version": "1.0.1", + "homepage": "https://github.com/mikeokner/jquery.scrollTableBody", + "authors": [ + "Michael Okner ", + "Noah Heldman " + ], + "description": "Easily scroll HTML table bodies while header/footer remain fixed", + "main": "src/jquery.scrollTableBody-1.0.1.js", + "moduleType": [ + "globals" + ], + "keywords": [ + "scroll", + "table", + "body", + "jquery", + "overflow" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +}