├── LICENSE ├── README.md ├── bower.json ├── dist ├── css │ ├── reflow-table.css │ └── reflow-table.min.css └── js │ ├── reflow-table.js │ └── reflow-table.min.js ├── docs ├── dist │ ├── css │ │ └── reflow-table.css │ └── js │ │ └── reflow-table.js ├── index.html └── narrow-jumbotron.css ├── img ├── demo-mobile.png └── demo-origin.png ├── package.json └── src ├── css └── reflow-table.css └── js └── reflow-table.js /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Nick Tsai 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
... | 99 | 100 | 101 |... | 102 | 103 |
---|
Company | 49 |Last Trade | 50 |Trade Time | 51 |Change | 52 |Prev Close | 53 |Open | 54 |Bid | 55 |Ask | 56 |1y Target Est | 57 |Lorem | 58 |Ipsum | 59 |
---|---|---|---|---|---|---|---|---|---|---|
GOOG Google Inc. | 64 |597.74 | 65 |12:12PM | 66 |14.81 (2.54%) | 67 |582.93 | 68 |597.95 | 69 |597.73 x 100 | 70 |597.91 x 300 | 71 |731.10 | 72 |Spanning cell | 73 ||
AAPL Apple Inc. | 76 |378.94 | 77 |12:22PM | 78 |5.74 (1.54%) | 79 |373.20 | 80 |381.02 | 81 |378.92 x 300 | 82 |378.99 x 100 | 83 |505.94 | 84 |Spanning cell | 85 ||
AMZN Amazon.com Inc. | 88 |191.55 | 89 |12:23PM | 90 |3.16 (1.68%) | 91 |188.39 | 92 |194.99 | 93 |191.52 x 300 | 94 |191.58 x 100 | 95 |240.32 | 96 |Spanning cell | 97 ||
ORCL Oracle Corporation | 100 |31.15 | 101 |12:44PM | 102 |1.41 (4.72%) | 103 |29.74 | 104 |30.67 | 105 |31.14 x 6500 | 106 |31.15 x 3200 | 107 |36.11 | 108 |Spanning cell | 109 ||
MSFT Microsoft Corporation | 112 |25.50 | 113 |12:27PM | 114 |0.66 (2.67%) | 115 |24.84 | 116 |25.37 | 117 |25.50 x 71100 | 118 |25.51 x 17800 | 119 |31.50 | 120 |Non-spanning | 121 |Non-spanning | 122 |
CSCO Cisco Systems, Inc. | 125 |18.65 | 126 |12:45PM | 127 |0.97 (5.49%) | 128 |17.68 | 129 |18.23 | 130 |18.65 x 10300 | 131 |18.66 x 24000 | 132 |21.12 | 133 |Non-spanning | 134 |Non-spanning | 135 |
YHOO Yahoo! Inc. | 138 |15.81 | 139 |12:25PM | 140 |0.11 (0.67%) | 141 |15.70 | 142 |15.94 | 143 |15.79 x 6100 | 144 |15.80 x 17000 | 145 |18.16 | 146 |Non-spanning | 147 |Non-spanning | 148 |
$("#table-basic").reflowTable();160 |
170 | 171 | 172 | 173 |
174 |Company | 179 |Last Trade | 180 |Trade Time | 181 |Change | 182 |Prev Close | 183 |Open | 184 |Bid | 185 |Ask | 186 |1y Target Est | 187 |
---|---|---|---|---|---|---|---|---|
GOOG Google Inc. | 192 |597.74 | 193 |12:12PM | 194 |14.81 (2.54%) | 195 |582.93 | 196 |597.95 | 197 |597.73 x 100 | 198 |597.91 x 300 | 199 |731.10 | 200 |
AAPL Apple Inc. | 203 |378.94 | 204 |12:22PM | 205 |5.74 (1.54%) | 206 |373.20 | 207 |381.02 | 208 |378.92 x 300 | 209 |378.99 x 100 | 210 |505.94 | 211 |
AMZN Amazon.com Inc. | 214 |191.55 | 215 |12:23PM | 216 |3.16 (1.68%) | 217 |188.39 | 218 |194.99 | 219 |191.52 x 300 | 220 |191.58 x 100 | 221 |240.32 | 222 |
ORCL Oracle Corporation | 225 |31.15 | 226 |12:44PM | 227 |1.41 (4.72%) | 228 |29.74 | 229 |30.67 | 230 |31.14 x 6500 | 231 |31.15 x 3200 | 232 |36.11 | 233 |
MSFT Microsoft Corporation | 236 |25.50 | 237 |12:27PM | 238 |0.66 (2.67%) | 239 |24.84 | 240 |25.37 | 241 |25.50 x 71100 | 242 |25.51 x 17800 | 243 |31.50 | 244 |
CSCO Cisco Systems, Inc. | 247 |18.65 | 248 |12:45PM | 249 |0.97 (5.49%) | 250 |17.68 | 251 |18.23 | 252 |18.65 x 10300 | 253 |18.66 x 24000 | 254 |21.12 | 255 |
YHOO Yahoo! Inc. | 258 |15.81 | 259 |12:25PM | 260 |0.11 (0.67%) | 261 |15.70 | 262 |15.94 | 263 |15.79 x 6100 | 264 |15.80 x 17000 | 265 |18.16 | 266 |
var reflowTable = $("#table-toggle").reflowTable({ 277 | 'autoWidth': false, 278 | }); 279 | // Add click listener for mobile-on 280 | $(".btn-reflow-toggle-mobile-on").click(function () { 281 | reflowTable.mobileMode(true); 282 | }); 283 | // Add click listener for mobile-off 284 | $(".btn-reflow-toggle-mobile-off").click(function () { 285 | reflowTable.mobileMode(false); 286 | }); 287 | // Add click listener for mobile switcher 288 | $(".btn-reflow-toggle-mobile-switch").click(function () { 289 | reflowTable.switchMode(); 290 | });291 |
Company | 305 |Last Trade | 306 |Trade Time | 307 |Change | 308 |Prev Close | 309 |Open | 310 |Bid | 311 |Ask | 312 |1y Target Est | 313 |
---|---|---|---|---|---|---|---|---|
GOOG Google Inc. | 318 |597.74 | 319 |12:12PM | 320 |14.81 (2.54%) | 321 |582.93 | 322 |597.95 | 323 |597.73 x 100 | 324 |597.91 x 300 | 325 |731.10 | 326 |
AAPL Apple Inc. | 329 |378.94 | 330 |12:22PM | 331 |5.74 (1.54%) | 332 |373.20 | 333 |381.02 | 334 |378.92 x 300 | 335 |378.99 x 100 | 336 |505.94 | 337 |
AMZN Amazon.com Inc. | 340 |191.55 | 341 |12:23PM | 342 |3.16 (1.68%) | 343 |188.39 | 344 |194.99 | 345 |191.52 x 300 | 346 |191.58 x 100 | 347 |240.32 | 348 |
ORCL Oracle Corporation | 351 |31.15 | 352 |12:44PM | 353 |1.41 (4.72%) | 354 |29.74 | 355 |30.67 | 356 |31.14 x 6500 | 357 |31.15 x 3200 | 358 |36.11 | 359 |
$("#table-mobile-only").reflowTable({ 370 | 'autoWidth': false, 371 | }).mobileMode(true);372 |
Company | 386 |Last Trade | 387 |Trade Time | 388 |Change | 389 |Prev Close | 390 |Open | 391 |Bid | 392 |Ask | 393 |1y Target Est | 394 |
---|---|---|---|---|---|---|---|---|
GOOG Google Inc. | 399 |597.74 | 400 |12:12PM | 401 |14.81 (2.54%) | 402 |582.93 | 403 |597.95 | 404 |597.73 x 100 | 405 |597.91 x 300 | 406 |731.10 | 407 |
AAPL Apple Inc. | 410 |378.94 | 411 |12:22PM | 412 |5.74 (1.54%) | 413 |373.20 | 414 |381.02 | 415 |378.92 x 300 | 416 |378.99 x 100 | 417 |505.94 | 418 |
$("#table-customized-css").addClass('reflow-table-customized-style') 429 | .reflowTable({ 430 | 'autoWidth': false, 431 | }).mobileMode(true);432 |
442 | 443 | 444 | 445 |
446 |Company | 451 |Last Trade | 452 |Trade Time | 453 |Change | 454 |Prev Close | 455 |Open | 456 |Bid | 457 |Ask | 458 |1y Target Est | 459 |
---|---|---|---|---|---|---|---|---|
GOOG Google Inc. | 464 |597.74 | 465 |12:12PM | 466 |14.81 (2.54%) | 467 |582.93 | 468 |597.95 | 469 |597.73 x 100 | 470 |597.91 x 300 | 471 |731.10 | 472 |
AAPL Apple Inc. | 475 |378.94 | 476 |12:22PM | 477 |5.74 (1.54%) | 478 |373.20 | 479 |381.02 | 480 |378.92 x 300 | 481 |378.99 x 100 | 482 |505.94 | 483 |
// Reflow Table with Events 494 | var reflowEvents = $("#table-events").reflowTable({ 495 | // 'autoWidth': false, 496 | 'eventMobileOn': function() { 497 | alert('This table is in Mobile mode now'); 498 | }, 499 | 'eventMobileOff': function() { 500 | alert('This table is in Desktop mode now'); 501 | }, 502 | }); 503 | // Event Binding 504 | $("#table-events").on('reflow-table.mobile.on', function() { 505 | console.log('This table is in Mobile mode now (Trigger by Event binding)'); 506 | }); 507 | $("#table-events").on('reflow-table.mobile.off', function() { 508 | console.log('This table is in Desktop mode now (Trigger by Event binding)'); 509 | });510 |
520 | 521 | 522 | 523 |
524 |Company | 529 |Last Trade | 530 |Trade Time | 531 |Change | 532 |Prev Close | 533 |Open | 534 |Bid | 535 |Ask | 536 |1y Target Est | 537 |
---|---|---|---|---|---|---|---|---|
GOOG Google Inc. | 542 |597.74 | 543 |12:12PM | 544 |14.81 (2.54%) | 545 |582.93 | 546 |597.95 | 547 |597.73 x 100 | 548 |597.91 x 300 | 549 |731.10 | 550 |
AAPL Apple Inc. | 553 |378.94 | 554 |12:22PM | 555 |5.74 (1.54%) | 556 |373.20 | 557 |381.02 | 558 |378.92 x 300 | 559 |378.99 x 100 | 560 |505.94 | 561 |
AMZN Amazon.com Inc. | 564 |191.55 | 565 |12:23PM | 566 |3.16 (1.68%) | 567 |188.39 | 568 |194.99 | 569 |191.52 x 300 | 570 |191.58 x 100 | 571 |240.32 | 572 |
ORCL Oracle Corporation | 575 |31.15 | 576 |12:44PM | 577 |1.41 (4.72%) | 578 |29.74 | 579 |30.67 | 580 |31.14 x 6500 | 581 |31.15 x 3200 | 582 |36.11 | 583 |
MSFT Microsoft Corporation | 586 |25.50 | 587 |12:27PM | 588 |0.66 (2.67%) | 589 |24.84 | 590 |25.37 | 591 |25.50 x 71100 | 592 |25.51 x 17800 | 593 |31.50 | 594 |
CSCO Cisco Systems, Inc. | 597 |18.65 | 598 |12:45PM | 599 |0.97 (5.49%) | 600 |17.68 | 601 |18.23 | 602 |18.65 x 10300 | 603 |18.66 x 24000 | 604 |21.12 | 605 |
YHOO Yahoo! Inc. | 608 |15.81 | 609 |12:25PM | 610 |0.11 (0.67%) | 611 |15.70 | 612 |15.94 | 613 |15.79 x 6100 | 614 |15.80 x 17000 | 615 |18.16 | 616 |
GOOG Google Inc. | 620 |597.74 | 621 |12:12PM | 622 |14.81 (2.54%) | 623 |582.93 | 624 |597.95 | 625 |597.73 x 100 | 626 |597.91 x 300 | 627 |731.10 | 628 |
AAPL Apple Inc. | 631 |378.94 | 632 |12:22PM | 633 |5.74 (1.54%) | 634 |373.20 | 635 |381.02 | 636 |378.92 x 300 | 637 |378.99 x 100 | 638 |505.94 | 639 |
AMZN Amazon.com Inc. | 642 |191.55 | 643 |12:23PM | 644 |3.16 (1.68%) | 645 |188.39 | 646 |194.99 | 647 |191.52 x 300 | 648 |191.58 x 100 | 649 |240.32 | 650 |
ORCL Oracle Corporation | 653 |31.15 | 654 |12:44PM | 655 |1.41 (4.72%) | 656 |29.74 | 657 |30.67 | 658 |31.14 x 6500 | 659 |31.15 x 3200 | 660 |36.11 | 661 |
MSFT Microsoft Corporation | 664 |25.50 | 665 |12:27PM | 666 |0.66 (2.67%) | 667 |24.84 | 668 |25.37 | 669 |25.50 x 71100 | 670 |25.51 x 17800 | 671 |31.50 | 672 |
CSCO Cisco Systems, Inc. | 675 |18.65 | 676 |12:45PM | 677 |0.97 (5.49%) | 678 |17.68 | 679 |18.23 | 680 |18.65 x 10300 | 681 |18.66 x 24000 | 682 |21.12 | 683 |
YHOO Yahoo! Inc. | 686 |15.81 | 687 |12:25PM | 688 |0.11 (0.67%) | 689 |15.70 | 690 |15.94 | 691 |15.79 x 6100 | 692 |15.80 x 17000 | 693 |18.16 | 694 |
GOOG Google Inc. | 698 |597.74 | 699 |12:12PM | 700 |14.81 (2.54%) | 701 |582.93 | 702 |597.95 | 703 |597.73 x 100 | 704 |597.91 x 300 | 705 |731.10 | 706 |
AAPL Apple Inc. | 709 |378.94 | 710 |12:22PM | 711 |5.74 (1.54%) | 712 |373.20 | 713 |381.02 | 714 |378.92 x 300 | 715 |378.99 x 100 | 716 |505.94 | 717 |
AMZN Amazon.com Inc. | 720 |191.55 | 721 |12:23PM | 722 |3.16 (1.68%) | 723 |188.39 | 724 |194.99 | 725 |191.52 x 300 | 726 |191.58 x 100 | 727 |240.32 | 728 |
ORCL Oracle Corporation | 731 |31.15 | 732 |12:44PM | 733 |1.41 (4.72%) | 734 |29.74 | 735 |30.67 | 736 |31.14 x 6500 | 737 |31.15 x 3200 | 738 |36.11 | 739 |
MSFT Microsoft Corporation | 742 |25.50 | 743 |12:27PM | 744 |0.66 (2.67%) | 745 |24.84 | 746 |25.37 | 747 |25.50 x 71100 | 748 |25.51 x 17800 | 749 |31.50 | 750 |
CSCO Cisco Systems, Inc. | 753 |18.65 | 754 |12:45PM | 755 |0.97 (5.49%) | 756 |17.68 | 757 |18.23 | 758 |18.65 x 10300 | 759 |18.66 x 24000 | 760 |21.12 | 761 |
YHOO Yahoo! Inc. | 764 |15.81 | 765 |12:25PM | 766 |0.11 (0.67%) | 767 |15.70 | 768 |15.94 | 769 |15.79 x 6100 | 770 |15.80 x 17000 | 771 |18.16 | 772 |
/** 783 | * DataTables integration 784 | * 785 | * For this integration, we choose `drawCallback` to implement Reflow Table update. 786 | * DataTables `page.dt` event is triggered too early before draw, while `createdRow` is lacked 787 | * of flexibility. 788 | * 789 | * @see https://datatables.net/reference/option/drawCallback 790 | */ 791 | var datatables = $('#table-datatables').DataTable({ 792 | 793 | "drawCallback": function( settings ) { 794 | // Bind a draw callback to re-build row th title for Reflow Table after 795 | $("#table-datatables").reflowTable('update'); 796 | } 797 | }); 798 | // Initialize Reflow Table (Before or after DataTables are both accepted) 799 | var reflowDataTable = $("#table-datatables").reflowTable({ 800 | 'autoWidth': false, 801 | });802 |