Recommend A Solution For Large HTML Data Tables?












1















I'm renovating a legacy Java webapp. I redid a screen that displays the results of a database search. The search can potentially produce a large number of results. The legacy version just printed everything. I went one better by putting in some divs and CSS such that horizontal and vertical scrollbars appear when needed.



This is not so great. The user loses sight of the column headers when scrolling vertically through many rows. Putting the column headers in their own div is not a great solution, as there are JUST ENOUGH columns to require horizontal scrolling too. The user would get stuck scrolling the results vertically and then scrolling the column names horizontally.



Would anyone care to recommend a solution that will not involve spending money or involve learning a whole new framework or system?



I don't need something high powered. Like I wrote, if the number of columns were just 2-3 fewer I probably wouldn't need horizontal scrolling and could just put the headers in their own stationary div.










share|improve this question

























  • Check out: stackoverflow.com/questions/1030043/…

    – Ryan B
    Jun 16 '12 at 20:18
















1















I'm renovating a legacy Java webapp. I redid a screen that displays the results of a database search. The search can potentially produce a large number of results. The legacy version just printed everything. I went one better by putting in some divs and CSS such that horizontal and vertical scrollbars appear when needed.



This is not so great. The user loses sight of the column headers when scrolling vertically through many rows. Putting the column headers in their own div is not a great solution, as there are JUST ENOUGH columns to require horizontal scrolling too. The user would get stuck scrolling the results vertically and then scrolling the column names horizontally.



Would anyone care to recommend a solution that will not involve spending money or involve learning a whole new framework or system?



I don't need something high powered. Like I wrote, if the number of columns were just 2-3 fewer I probably wouldn't need horizontal scrolling and could just put the headers in their own stationary div.










share|improve this question

























  • Check out: stackoverflow.com/questions/1030043/…

    – Ryan B
    Jun 16 '12 at 20:18














1












1








1








I'm renovating a legacy Java webapp. I redid a screen that displays the results of a database search. The search can potentially produce a large number of results. The legacy version just printed everything. I went one better by putting in some divs and CSS such that horizontal and vertical scrollbars appear when needed.



This is not so great. The user loses sight of the column headers when scrolling vertically through many rows. Putting the column headers in their own div is not a great solution, as there are JUST ENOUGH columns to require horizontal scrolling too. The user would get stuck scrolling the results vertically and then scrolling the column names horizontally.



Would anyone care to recommend a solution that will not involve spending money or involve learning a whole new framework or system?



I don't need something high powered. Like I wrote, if the number of columns were just 2-3 fewer I probably wouldn't need horizontal scrolling and could just put the headers in their own stationary div.










share|improve this question
















I'm renovating a legacy Java webapp. I redid a screen that displays the results of a database search. The search can potentially produce a large number of results. The legacy version just printed everything. I went one better by putting in some divs and CSS such that horizontal and vertical scrollbars appear when needed.



This is not so great. The user loses sight of the column headers when scrolling vertically through many rows. Putting the column headers in their own div is not a great solution, as there are JUST ENOUGH columns to require horizontal scrolling too. The user would get stuck scrolling the results vertically and then scrolling the column names horizontally.



Would anyone care to recommend a solution that will not involve spending money or involve learning a whole new framework or system?



I don't need something high powered. Like I wrote, if the number of columns were just 2-3 fewer I probably wouldn't need horizontal scrolling and could just put the headers in their own stationary div.







html css html-table






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 31 '18 at 21:48









Brian Tompsett - 汤莱恩

4,2231338101




4,2231338101










asked Jun 16 '12 at 20:12









SteveSteve

1,172124584




1,172124584













  • Check out: stackoverflow.com/questions/1030043/…

    – Ryan B
    Jun 16 '12 at 20:18



















  • Check out: stackoverflow.com/questions/1030043/…

    – Ryan B
    Jun 16 '12 at 20:18

















Check out: stackoverflow.com/questions/1030043/…

– Ryan B
Jun 16 '12 at 20:18





Check out: stackoverflow.com/questions/1030043/…

– Ryan B
Jun 16 '12 at 20:18












4 Answers
4






active

oldest

votes


















7














I use datatables to display tables. It is some jquery that turns plane tables into sortable, searchable nicely looking tables.



http://datatables.net/






share|improve this answer































    0














    Why not repeat the column headers say every 20 rows so when the headers have scrolled off the screen you have them further down to. This could be done in your server side script.






    share|improve this answer































      0














      You should be using paging in your query. For example when fetching page 7 and page size is 10, only record number 61 to 70 must be fetched from database.






      share|improve this answer































        0














        One easy way to go is to just repeat headers periodically. The code below shows how to do it, no libraries required. The sample builds a sample huge table (100 columns, 100 rows) and then just clones the header row every 10 rows.






        const COLS = 100;
        const ROWS = 100;
        const HEADER_PERIOD = 10;

        const table = document.querySelector("table");

        // prepare header template
        const header = document.createElement("tr");
        header.classList.add("header");
        for (let i = 0; i < COLS; i++) {
        const cell = header.insertCell();
        cell.innerText = String.fromCharCode(65 + Math.floor(Math.random() * 26));
        }

        // make some random rows and columns
        for (let j = 0; j < ROWS; j++) {

        // repeat header row periodically so user doesn't get lost
        if (j % HEADER_PERIOD === 0) {
        table.appendChild(header.cloneNode(true));
        }

        const row = table.insertRow();
        for (let i = 0; i < COLS; i++) {
        const cell = row.insertCell();
        cell.innerText = Math.trunc(10 + Math.random() * 90).toFixed();
        }
        }

        body {
        font-family: monospace, sans-serif;
        }
        table {
        border-collapse: collapse;
        }
        th, td {
        padding: 2px;
        border: 1px solid;
        margin: 0;
        }
        .header {
        background-color: #ccc;
        text-align: center;
        font-weight: bold;
        }

        <!DOCTYPE html>
        <html lang="en">
        <head>
        <meta charset="UTF-8">
        <title>Large table</title>
        </head>
        <body>

        <table>
        </table>

        </body>
        </html>








        share|improve this answer























          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11066698%2frecommend-a-solution-for-large-html-data-tables%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          7














          I use datatables to display tables. It is some jquery that turns plane tables into sortable, searchable nicely looking tables.



          http://datatables.net/






          share|improve this answer




























            7














            I use datatables to display tables. It is some jquery that turns plane tables into sortable, searchable nicely looking tables.



            http://datatables.net/






            share|improve this answer


























              7












              7








              7







              I use datatables to display tables. It is some jquery that turns plane tables into sortable, searchable nicely looking tables.



              http://datatables.net/






              share|improve this answer













              I use datatables to display tables. It is some jquery that turns plane tables into sortable, searchable nicely looking tables.



              http://datatables.net/







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jun 16 '12 at 20:18









              cantaffordretailcantaffordretail

              80622042




              80622042

























                  0














                  Why not repeat the column headers say every 20 rows so when the headers have scrolled off the screen you have them further down to. This could be done in your server side script.






                  share|improve this answer




























                    0














                    Why not repeat the column headers say every 20 rows so when the headers have scrolled off the screen you have them further down to. This could be done in your server side script.






                    share|improve this answer


























                      0












                      0








                      0







                      Why not repeat the column headers say every 20 rows so when the headers have scrolled off the screen you have them further down to. This could be done in your server side script.






                      share|improve this answer













                      Why not repeat the column headers say every 20 rows so when the headers have scrolled off the screen you have them further down to. This could be done in your server side script.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jun 16 '12 at 20:19









                      chris_codechris_code

                      47449




                      47449























                          0














                          You should be using paging in your query. For example when fetching page 7 and page size is 10, only record number 61 to 70 must be fetched from database.






                          share|improve this answer




























                            0














                            You should be using paging in your query. For example when fetching page 7 and page size is 10, only record number 61 to 70 must be fetched from database.






                            share|improve this answer


























                              0












                              0








                              0







                              You should be using paging in your query. For example when fetching page 7 and page size is 10, only record number 61 to 70 must be fetched from database.






                              share|improve this answer













                              You should be using paging in your query. For example when fetching page 7 and page size is 10, only record number 61 to 70 must be fetched from database.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jun 16 '12 at 21:09









                              AtifAtif

                              193319




                              193319























                                  0














                                  One easy way to go is to just repeat headers periodically. The code below shows how to do it, no libraries required. The sample builds a sample huge table (100 columns, 100 rows) and then just clones the header row every 10 rows.






                                  const COLS = 100;
                                  const ROWS = 100;
                                  const HEADER_PERIOD = 10;

                                  const table = document.querySelector("table");

                                  // prepare header template
                                  const header = document.createElement("tr");
                                  header.classList.add("header");
                                  for (let i = 0; i < COLS; i++) {
                                  const cell = header.insertCell();
                                  cell.innerText = String.fromCharCode(65 + Math.floor(Math.random() * 26));
                                  }

                                  // make some random rows and columns
                                  for (let j = 0; j < ROWS; j++) {

                                  // repeat header row periodically so user doesn't get lost
                                  if (j % HEADER_PERIOD === 0) {
                                  table.appendChild(header.cloneNode(true));
                                  }

                                  const row = table.insertRow();
                                  for (let i = 0; i < COLS; i++) {
                                  const cell = row.insertCell();
                                  cell.innerText = Math.trunc(10 + Math.random() * 90).toFixed();
                                  }
                                  }

                                  body {
                                  font-family: monospace, sans-serif;
                                  }
                                  table {
                                  border-collapse: collapse;
                                  }
                                  th, td {
                                  padding: 2px;
                                  border: 1px solid;
                                  margin: 0;
                                  }
                                  .header {
                                  background-color: #ccc;
                                  text-align: center;
                                  font-weight: bold;
                                  }

                                  <!DOCTYPE html>
                                  <html lang="en">
                                  <head>
                                  <meta charset="UTF-8">
                                  <title>Large table</title>
                                  </head>
                                  <body>

                                  <table>
                                  </table>

                                  </body>
                                  </html>








                                  share|improve this answer




























                                    0














                                    One easy way to go is to just repeat headers periodically. The code below shows how to do it, no libraries required. The sample builds a sample huge table (100 columns, 100 rows) and then just clones the header row every 10 rows.






                                    const COLS = 100;
                                    const ROWS = 100;
                                    const HEADER_PERIOD = 10;

                                    const table = document.querySelector("table");

                                    // prepare header template
                                    const header = document.createElement("tr");
                                    header.classList.add("header");
                                    for (let i = 0; i < COLS; i++) {
                                    const cell = header.insertCell();
                                    cell.innerText = String.fromCharCode(65 + Math.floor(Math.random() * 26));
                                    }

                                    // make some random rows and columns
                                    for (let j = 0; j < ROWS; j++) {

                                    // repeat header row periodically so user doesn't get lost
                                    if (j % HEADER_PERIOD === 0) {
                                    table.appendChild(header.cloneNode(true));
                                    }

                                    const row = table.insertRow();
                                    for (let i = 0; i < COLS; i++) {
                                    const cell = row.insertCell();
                                    cell.innerText = Math.trunc(10 + Math.random() * 90).toFixed();
                                    }
                                    }

                                    body {
                                    font-family: monospace, sans-serif;
                                    }
                                    table {
                                    border-collapse: collapse;
                                    }
                                    th, td {
                                    padding: 2px;
                                    border: 1px solid;
                                    margin: 0;
                                    }
                                    .header {
                                    background-color: #ccc;
                                    text-align: center;
                                    font-weight: bold;
                                    }

                                    <!DOCTYPE html>
                                    <html lang="en">
                                    <head>
                                    <meta charset="UTF-8">
                                    <title>Large table</title>
                                    </head>
                                    <body>

                                    <table>
                                    </table>

                                    </body>
                                    </html>








                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      One easy way to go is to just repeat headers periodically. The code below shows how to do it, no libraries required. The sample builds a sample huge table (100 columns, 100 rows) and then just clones the header row every 10 rows.






                                      const COLS = 100;
                                      const ROWS = 100;
                                      const HEADER_PERIOD = 10;

                                      const table = document.querySelector("table");

                                      // prepare header template
                                      const header = document.createElement("tr");
                                      header.classList.add("header");
                                      for (let i = 0; i < COLS; i++) {
                                      const cell = header.insertCell();
                                      cell.innerText = String.fromCharCode(65 + Math.floor(Math.random() * 26));
                                      }

                                      // make some random rows and columns
                                      for (let j = 0; j < ROWS; j++) {

                                      // repeat header row periodically so user doesn't get lost
                                      if (j % HEADER_PERIOD === 0) {
                                      table.appendChild(header.cloneNode(true));
                                      }

                                      const row = table.insertRow();
                                      for (let i = 0; i < COLS; i++) {
                                      const cell = row.insertCell();
                                      cell.innerText = Math.trunc(10 + Math.random() * 90).toFixed();
                                      }
                                      }

                                      body {
                                      font-family: monospace, sans-serif;
                                      }
                                      table {
                                      border-collapse: collapse;
                                      }
                                      th, td {
                                      padding: 2px;
                                      border: 1px solid;
                                      margin: 0;
                                      }
                                      .header {
                                      background-color: #ccc;
                                      text-align: center;
                                      font-weight: bold;
                                      }

                                      <!DOCTYPE html>
                                      <html lang="en">
                                      <head>
                                      <meta charset="UTF-8">
                                      <title>Large table</title>
                                      </head>
                                      <body>

                                      <table>
                                      </table>

                                      </body>
                                      </html>








                                      share|improve this answer













                                      One easy way to go is to just repeat headers periodically. The code below shows how to do it, no libraries required. The sample builds a sample huge table (100 columns, 100 rows) and then just clones the header row every 10 rows.






                                      const COLS = 100;
                                      const ROWS = 100;
                                      const HEADER_PERIOD = 10;

                                      const table = document.querySelector("table");

                                      // prepare header template
                                      const header = document.createElement("tr");
                                      header.classList.add("header");
                                      for (let i = 0; i < COLS; i++) {
                                      const cell = header.insertCell();
                                      cell.innerText = String.fromCharCode(65 + Math.floor(Math.random() * 26));
                                      }

                                      // make some random rows and columns
                                      for (let j = 0; j < ROWS; j++) {

                                      // repeat header row periodically so user doesn't get lost
                                      if (j % HEADER_PERIOD === 0) {
                                      table.appendChild(header.cloneNode(true));
                                      }

                                      const row = table.insertRow();
                                      for (let i = 0; i < COLS; i++) {
                                      const cell = row.insertCell();
                                      cell.innerText = Math.trunc(10 + Math.random() * 90).toFixed();
                                      }
                                      }

                                      body {
                                      font-family: monospace, sans-serif;
                                      }
                                      table {
                                      border-collapse: collapse;
                                      }
                                      th, td {
                                      padding: 2px;
                                      border: 1px solid;
                                      margin: 0;
                                      }
                                      .header {
                                      background-color: #ccc;
                                      text-align: center;
                                      font-weight: bold;
                                      }

                                      <!DOCTYPE html>
                                      <html lang="en">
                                      <head>
                                      <meta charset="UTF-8">
                                      <title>Large table</title>
                                      </head>
                                      <body>

                                      <table>
                                      </table>

                                      </body>
                                      </html>








                                      const COLS = 100;
                                      const ROWS = 100;
                                      const HEADER_PERIOD = 10;

                                      const table = document.querySelector("table");

                                      // prepare header template
                                      const header = document.createElement("tr");
                                      header.classList.add("header");
                                      for (let i = 0; i < COLS; i++) {
                                      const cell = header.insertCell();
                                      cell.innerText = String.fromCharCode(65 + Math.floor(Math.random() * 26));
                                      }

                                      // make some random rows and columns
                                      for (let j = 0; j < ROWS; j++) {

                                      // repeat header row periodically so user doesn't get lost
                                      if (j % HEADER_PERIOD === 0) {
                                      table.appendChild(header.cloneNode(true));
                                      }

                                      const row = table.insertRow();
                                      for (let i = 0; i < COLS; i++) {
                                      const cell = row.insertCell();
                                      cell.innerText = Math.trunc(10 + Math.random() * 90).toFixed();
                                      }
                                      }

                                      body {
                                      font-family: monospace, sans-serif;
                                      }
                                      table {
                                      border-collapse: collapse;
                                      }
                                      th, td {
                                      padding: 2px;
                                      border: 1px solid;
                                      margin: 0;
                                      }
                                      .header {
                                      background-color: #ccc;
                                      text-align: center;
                                      font-weight: bold;
                                      }

                                      <!DOCTYPE html>
                                      <html lang="en">
                                      <head>
                                      <meta charset="UTF-8">
                                      <title>Large table</title>
                                      </head>
                                      <body>

                                      <table>
                                      </table>

                                      </body>
                                      </html>





                                      const COLS = 100;
                                      const ROWS = 100;
                                      const HEADER_PERIOD = 10;

                                      const table = document.querySelector("table");

                                      // prepare header template
                                      const header = document.createElement("tr");
                                      header.classList.add("header");
                                      for (let i = 0; i < COLS; i++) {
                                      const cell = header.insertCell();
                                      cell.innerText = String.fromCharCode(65 + Math.floor(Math.random() * 26));
                                      }

                                      // make some random rows and columns
                                      for (let j = 0; j < ROWS; j++) {

                                      // repeat header row periodically so user doesn't get lost
                                      if (j % HEADER_PERIOD === 0) {
                                      table.appendChild(header.cloneNode(true));
                                      }

                                      const row = table.insertRow();
                                      for (let i = 0; i < COLS; i++) {
                                      const cell = row.insertCell();
                                      cell.innerText = Math.trunc(10 + Math.random() * 90).toFixed();
                                      }
                                      }

                                      body {
                                      font-family: monospace, sans-serif;
                                      }
                                      table {
                                      border-collapse: collapse;
                                      }
                                      th, td {
                                      padding: 2px;
                                      border: 1px solid;
                                      margin: 0;
                                      }
                                      .header {
                                      background-color: #ccc;
                                      text-align: center;
                                      font-weight: bold;
                                      }

                                      <!DOCTYPE html>
                                      <html lang="en">
                                      <head>
                                      <meta charset="UTF-8">
                                      <title>Large table</title>
                                      </head>
                                      <body>

                                      <table>
                                      </table>

                                      </body>
                                      </html>






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Dec 31 '18 at 22:50









                                      Lucio PaivaLucio Paiva

                                      6,63523755




                                      6,63523755






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11066698%2frecommend-a-solution-for-large-html-data-tables%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Monofisismo

                                          Angular Downloading a file using contenturl with Basic Authentication

                                          Olmecas