My first column won't change width

My first column won't change width

FuturShocFuturShoc Posts: 3Questions: 0Answers: 0
edited May 2011 in General
Here's my table code:

[code]

$(document).ready(function() {
$('#gs_list').dataTable({
"sPaginationType": "full_numbers"
});
} );

[/code]

My problem is that I'm using the first column as an ID when displaying records. However, that ID column only needs to be, say, 25 pixels wide. Thing is, DataTables seems to force that column to be way wider than it needs to be. Always.

I've tried defining column widths in the code above, but they all change EXCEPT for the first column, which remains very wide.

I've even tried adding an inline style to the first tag, but no change. :-(

Am I missing something here?

Replies

  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Can you give us a link to the page with the problem please? Also what version of DataTables are you using?

    Thanks,
    Allan
  • FuturShocFuturShoc Posts: 3Questions: 0Answers: 0
    Nuts, its on a company intranet, so that's tough to do. I'll try posting the output here:

    [code]


    DteTitleStatusClientDesigneraeType


    05-06-2011
    Marys gs
    open
    Client one
    dirk
    julie
    web
    05-06-2011
    TEst Print GS FC blah
    inprod
    client two
    jason
    georgia
    print
    05-06-2011
    TEst Print GS Dir SPot
    open
    client two
    jason
    georgia
    print
    05-06-2011
    Test Print GS bill Gray
    open
    client two
    jason
    georgia
    print
    05-06-2011
    Test Print GS bill
    open
    client two
    jason
    georgia
    print


    DteTitleStatusClientDesigneraeType


    [/code]
  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Which version of DataTables are you using and what is the initialisation please?

    You say that it is the first column which is causing problems. You want it to be only 25px wide - however the content in it will take up significantly more than 25px "05-06-2011" for example is about 65px, then add whatever padding your table cells might have... :-)

    Allan
  • FuturShocFuturShoc Posts: 3Questions: 0Answers: 0
    The initialization is in my first post.

    As for the HTML I posted, I did remove the ID column before I posted it, but that doesn't affect its behavior. I can't adjust the first column, no matter what is contained in it.
  • allanallan Posts: 63,522Questions: 1Answers: 10,473 Site admin
    Sorry about that - I missed the initial code in your first post there. So the date isn't in the first column - what kind of data is? Will it be taking up more than 25px?

    I've just released 1.8 beta 2 in which I've made a number of tweaks to how the column width is calculated. It might be worth giving that a go. Another option that springs to mind is to set td { overflow: hidden } in your CSS so any content that is taking up more space than is avaibke is hidden.

    Are you able to put a cut down version of your table showing the problem in JS fiddle or on a public site?

    Thanks,
    Allan
This discussion has been closed.