Improve table header view using bootstrap 3.0.0, datatables and fixedHeader

Asked

Viewed 566 times

3

I’m using in a system the bootstrap, datatables and fixedHeader, I’m in three trouble:

  1. I would need that header (thead) table stops before the end of the menu, gets below the menu, it’s stopping at the top of the page, has how to do this?

  2. When I open the dialog (by clicking on link of each line at the end) thead is behind the dialog, but it is the only element that is not behind the modal (I think that’s it);

  3. When I click on a menu, the sub-menu items are also behind the thead;

HTML, I wouldn’t like to leave it here, because it’s a bit long, but if it is the case, I even put;

The JS to do this is this

var oTable = $('#example').dataTable({
    "paging": false,
    "info": false
});

new $.fn.dataTable.FixedHeader( oTable, {
  "zTop": "1035"
});

Follow the codes here http://jsbin.com/regetiyaki/1/edit?html,css,js

And here already running the example http://jsbin.com/regetiyaki/1/

PS: I am currently with bootstrap version 3.0.0 and I cannot upgrade to the current version, in this case, 3.3.5, I did this test and in this case I would solve my question 2, but unfortunately I do not have to do this update.

Follows a print of mistakes, you can already see that the thead is above the menu (at the top of the page) and is not behind the modal.

inserir a descrição da imagem aqui

1 answer

2


Marcelo,

You can use the offsetTop to do this, example:

    var oTable = $('#example').dataTable({
        "paging": false,
        "info": false
    });

    new $.fn.dataTable.FixedHeader(oTable, {
        "offsetTop": 50
    });

Working example: JSFIDDLE

  • This was my first attempt, but as it is a table with many columns has become all disfigured, in some cases I’m using this cool, simpler even and a plugin less, but there are some cases I will have to use Fixedheader even.

  • Got it, I’m using it this way, the way you’re doing if you change the "zTop" to 1030 won’t show the problem n° 2

  • to fix the problem 1° it is necessary to make a check, it is fixed on the top of the body and it is necessary that it is fixed on the bottom of the navbar...

  • Look, now with these changes, zTop and adding the offsetTop I have already solved the first and the second point, in this case, the main ones, of course the third point also have to solve, but it has helped me a lot with these two. Valew himself!!!

  • 2

    Voce can decrease zTop to 1020 or remove it so that all issues get resolved

  • This answer is being discussed in the target: http://meta.pt.stackoverflow.com/questions/4088/edi%C3%A7%C3%A3o-que-altera-um-pouco-a-resposta-original

  • 1

    my first idea in solving the problem was using scroll, after I tested the offsetTop I saw that I would only need it to resolve all doubts of Marcelo, I will reissue with only what was necessary to solve the problem, thank you Jorge.

  • 1

    @Marcelodiniz I rejected the edition, because I believe that in this case the author should edit and add the "zTop": "1020",, even if commented, maybe zTop is something that worked for you, but it can also be the use of html that affected Z, and in this case zTop would only work for you. I recommend that you comment to the author of the reply asking him to add this snippet to the code, if he thinks it’s part of the answer then OK, if not then his comment should suffice as "help" to your problem. :)

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.