Freeze table columns – DataTables

glacier_collapse_thawing_spring_gloomy_hd-wallpaper-46515

Fixed table

Today I’ll show you how can you freez table columns/rows on website in simple way. The best for it will be another great and powerful tool plug-in for JQuery library DataTables.

Example

In our example we need to include some scripts and styles like this:

First is JQuery script, lines 2-3 is plug-in for JQuery DataTables and the last is stylesheet for our library.

Operating principle is simple.On our table, we use the function „DataTable”.Then we set properties which we are interested in.

In our example it look like:

For the purpose of our example we set max height scroll to 400px.We can also set – how many columns we are freezing(7-8th line), we want paging in our table or not(6th line), etc.

Let’s see how it look on our ready-made sample table. HERE

Of course, we have more opportunity.If you want to know more options I refer you to the examples on the official website of this library.

Link to the project.

 

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *