Table with infinite columns

Hello Gurus !

I need some guidance / help regarding adding columns to a table on the fly. Suppose I have a table that has 35 columns. First 5 columns are for some data and that has to be fixed/freeze. Now the rest columns are for days in a month. Now what i want is that there should be a Next button OR may be scroll bar, once I click on it, it will remove the first 10 OR 15 columns (date side) and also add 10 or 15 more columns of next dates.

So for example, if it shows the days from 1st June 2016 to 30th June 2016, once I click on Next or scroll bar, it will now show dates like 15th June 2016 - 15th July 2016 and so on.

Please help me about this.

Thank you

You could write the whole table into the markup and show/hide rows by setting them to display: table and display: none respectively (either using dedicated classes or directly using the .style property); or you could dynamically insert table rows into the DOM. jQuery might come in handy here, too.

delete a column from a table in JavaScript -
add a column -

then all you need to do is add the code to retrieve the new data and load it into the new columns.

1 Like

Thank you Genius !


Can you please have a look at this thread : Sync all tables with scrollbars

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.