Column Size settings are not working

Column Size settings are not working

GiblinGiblin Posts: 4Questions: 0Answers: 0
edited January 2014 in DataTables 1.9
I'm working in v 1.9.4 and using jQuery UI v 1.10.3.

I have searched all over for an answer to this and nothing I'm finding is working.

I have a page that uses UI tabs. In that tab is a button that does an ajax call for new tables. The call returns fully formatted html tables that are then appended to a div on the page inside the tab using jQuery and then have the dataTable initialize called on the new table. The table is never hidden so that should not be an issue here. That all works great but then when I try to set the width of the columns nothing happens its like its getting over written or ignored. Here's my code.

HTML
[code]



1
2
3
4




Data 1
Data 2
Data 3
Data 4



[/code]

JS
[code]
$('#myprojects').on('click',function(){
$('#userprojects').val($('#myprojects').data('myid'));
$.ajax({
type: 'POST',
url: 'myservice.php',
cache:false,
data: {userID: $('#myprojects').data('myid') },
dataType: 'json',
success: function(data, textStatus){
if(data.error){
alert(data.error_msg);
}
else{
$('#tables').empty();
$('#tables').append(data.que);
var toBeStartedTabel = $('#toBeStarted').dataTable({"bAutoWidth": false,
"sScrollX": "100%",
"aoColumns": [
/*id*/{ "sWidth": "50px"},
/*client*/{ "sWidth": "100px"},
/*project*/null,
/*period*/null,
/*priority*/null,
/*in*/null,
/*due*/null,
/*Note*/{ "sWidth": "100px"}
]
});

toBeStartedTabel.fnAdjustColumnSizing();
$('#tables').append(data.inprocess);
var inprocessTabel = $('#inProcess').dataTable();
$('#tables').append(data.rework);
var inprocessTabel = $('#rework').dataTable();
$('#tables').append(data.review);
var inprocessTabel = $('#review').dataTable();
}
},
error: function(xhr, textStatus, errorThrown){
alert(errorThrown);
alert(xhr.responseText);
//alert(Object.keys(xhr));
}
});
});
[/code]

I have tried just about every solution on these forms and stack overflow with no luck.

Thank you

UPDATE: It appears that any and all setting in the dataTable function call is being ignored. I just tried to add aaSorting to the call and its being ignored as well. Can anyone shed some light on this please.

Replies

  • GiblinGiblin Posts: 4Questions: 0Answers: 0
    Can anyone help here I have been fighting this all weekend with no progress. I need to know why this is not working and how to fix it please.
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Can you please link to a test case showing the problem: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    Btw - your aoColumns has 8 columns defined in it, but your HTML only has 4. Probably not the issue (we'll need a test case for that), but possibly causing some issues.

    Allan
  • GiblinGiblin Posts: 4Questions: 0Answers: 0
    Thank you Allan for the response. I know the example has only 4 but the real table does have 8.

    Sorry about not having a test case I'm new here. I will try to build one up, for the working model is protected because of data sensitivity. Ill reply here again when I have a working case study running.


    Thank you again
    Giblin
  • GiblinGiblin Posts: 4Questions: 0Answers: 0
    Allan,

    Sorry to have bothered you I found the problem it was a duplicate code issue that was overwriting my changes.

    Thanks
    Giblin
This discussion has been closed.