Strange bug? Columns resize on click
Strange bug? Columns resize on click
compcentral
Posts: 40Questions: 0Answers: 0
For some reason, when DataTables loads the columns are not sized correctly and when I click on a column to sort it, the table grows wider with each click.
You can see it in action on my test site here:
http://208.94.40.202/courseEnroll/Course_Listing.php
Any suggestions?
JavaScript:
[code]
var oTable;
$(document).ready(function() {
/* Init the table */
oTable = $('#example').dataTable( {
"bProcessing": false,
"bServerSide": true,
"bStateSave": true,
"sAjaxSource": "DataTables/examples/examples_support/server_processing.php",
"bPaginate": true,
"sPaginationType": "full_numbers",
// or
//"bScrollInfinite": true,
"bAutoWidth": false,
//"sScrollX": "100%",
//"sScrollXInner": "100%",
"sScrollY": "150px",
//"bScrollCollapse": true,
"bJQueryUI": true,
// Sort first by course type, then by course name, then by start enroll date
"aaSorting": [[1, "asc"], [0, "asc"], [4, "asc"]],
} );
} );
[/code]
table:
[code]
Course Name
Course Type
Teacher
Host District
Number Enrolled
Start Date
End Date
Loading data from server
[/code]
You can see it in action on my test site here:
http://208.94.40.202/courseEnroll/Course_Listing.php
Any suggestions?
JavaScript:
[code]
var oTable;
$(document).ready(function() {
/* Init the table */
oTable = $('#example').dataTable( {
"bProcessing": false,
"bServerSide": true,
"bStateSave": true,
"sAjaxSource": "DataTables/examples/examples_support/server_processing.php",
"bPaginate": true,
"sPaginationType": "full_numbers",
// or
//"bScrollInfinite": true,
"bAutoWidth": false,
//"sScrollX": "100%",
//"sScrollXInner": "100%",
"sScrollY": "150px",
//"bScrollCollapse": true,
"bJQueryUI": true,
// Sort first by course type, then by course name, then by start enroll date
"aaSorting": [[1, "asc"], [0, "asc"], [4, "asc"]],
} );
} );
[/code]
table:
[code]
Course Name
Course Type
Teacher
Host District
Number Enrolled
Start Date
End Date
Loading data from server
[/code]
This discussion has been closed.
Replies
[code]
else if ('submit' == settings.onblur) {
input.blur(function(e) {
/* prevent double submit if submit was clicked */
t = setTimeout(function() {
form.submit();
}, 0);
});
[/code]
I also noticed that performing a search will trigger this behavior as well.
http://datatables.net/forums/comments.php?DiscussionID=2680
[code]
.dataTables_wrapper {
width: 700px;
}
[/code]
- columns resize automatically when searching
- webkit always sets table width to 100% of window (not sure it's related to this)
i found the resizing stops when altering one line in the source (datatables 1.7.6 line 3800):
[code]
o.nTable.style.width = "100%";
[/code]
to
[code]
o.nTable.style.width = "auto";
[/code]
webkit still does not size the table the way i want it to but at least it no longer sets it to 100% of window's size
the way i try to size the table is by adding classes to all of the tags in without any style markup or css attached to the table itself
any real solutions for precise table sizing and fixing the resize problem??
Allan
The issue occurred when using border-collapse:collapse with webkit. When I removed this, all was well.
Hope this helps,
Dave
Regards,
Allan
You can see what d7a7z7e7d described in his/her 2 march post happening. But in this case the onblur setting is cancel so the suggested fix which is for onblur == 'submit' achieves nothing. Whereas applying the suggested fix (timeout changed to 0) on the 'cancel' branch does fix the problem.
Though clearly this is not an ideal fix.
I have noticed that the jQuery DataTables Editable plug-in from Jovan Popovic does not appear to exhibit this problem.