Multiple table with aoColumnDefs

Multiple table with aoColumnDefs

blackmarneusblackmarneus Posts: 5Questions: 0Answers: 0
edited February 2014 in DataTables 1.9
Hi everyone,

I've got two tables on the same page which i initialize in the same times ($(document).ready).
I use these with tabbable (bootstrap 2.3.1) to switch from one to the other.
The first one haven't any problem, it is correctly initialized. But the second not. The column width isn't right.

Can you help me please?
Thanks

Replies

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Please link to a test case showing the issue, as stated in the new discussion form and the forum rules.

    At the moment, all I can suggest is that you use fnAdjustColumnSizing when the second table is made visible.

    Allan
  • blackmarneusblackmarneus Posts: 5Questions: 0Answers: 0
    Hi allan and thanks for your answer.

    Ok sorry, i'm new in this forum and i'm french, i don't understand exactly the rules but i'll try to do my best!

    link to the property in question : http://www.datatables.net/ref#sWidth

    the code i use :

    [code]
    $(document).ready(function() {

    $('#tableEncours').dataTable( {
    "bPaginate": true,
    "bLengthChange": true,
    "bFilter": true,
    "bSort": true,
    "bInfo": false,
    "bAutoWidth": true,
    "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
    "oLanguage": {
    "sSearch": "Filtre :"
    },
    "aoColumnDefs": [
    { "sWidth": "60%", "aTargets": ["detail"] }
    ]
    } );

    var historique = $('#tableHistorique').dataTable( {
    "bPaginate": true,
    "bLengthChange": true,
    "bFilter": true,
    "bSort": true,
    "bInfo": false,
    "bAutoWidth": true,
    "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
    "oLanguage": {
    "sSearch": "Filtre :"
    },
    "aoColumnDefs": [
    { "sWidth": "60%", "aTargets": ["detail"] }
    ]
    } );
    } );
    [/code]
  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    I need a link to the actual page, or please use JSFiddle, CodePen or http://live.datatables.net to construct a page that shows the problem so I can debug it.

    Allan
  • blackmarneusblackmarneus Posts: 5Questions: 0Answers: 0
    Thanks for your answer.

    I've some JSPX build with Tiles which contains part of datatable, my data come from JEE application and i initialize it with JQuery.
    I don't know how i can link you this, moreover, my application aren't yet online...
  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    I understand. But I'm afraid I can't offer any help then, since i can't see and debug the problem.

    Allan
  • blackmarneusblackmarneus Posts: 5Questions: 0Answers: 0
    Ok, i understand.
    Thanks for your answer, if i find the solution i'll come back to let you know how i fix it.
  • ashiersashiers Posts: 101Questions: 8Answers: 7
    Since you're on the Java platform, you may want to check out the JED website. There are many examples there showing how DataTables is used in a JEE application.
    Check it out: http://jed-datatables.ca/jed/
  • blackmarneusblackmarneus Posts: 5Questions: 0Answers: 0
    Thank you ashiers.

    The problem is fixed : i'd let the "bAutoWith : true" property, it seems to be in conflict with aoColumnsDefs. All work fine.

    Thanks you for your answers!
  • peterrowpeterrow Posts: 4Questions: 0Answers: 0

    I had the same issue.
    My problem was I was doing server side/AJAX calls to get the data.
    So when I tried to set specify % widths on some columns it just broke; I just had the processing throbber shown - it would be nice if conflicting configuration settings caused a console log entry or at least an alert to avoid unnecessary time spent double checking the syntax and surrounding JS.

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Generally it should - although obviously invalid syntax is something that the Javascript engine will check for. If you could show me what you had that caused the problem I might be able to do something about it in a future release?

    Allan

This discussion has been closed.