jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Column width "Auto" no longer works
Tagged: grid columns width
This topic contains 12 replies, has 3 voices, and was last updated by Peter Stoev 11 years, 6 months ago.
-
Author
-
You used to be able to have a column fill width auto but now this does not work in version 3.02
that is set column width attribute to “auto”
Hi Karl,
There has never been such built-in setting for a width. If you want “auto” behavior”, don’t set the width.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/thanks peter, I was wondering why I could not find it in documentation. I had been using this attribute, it must have been ignoring it.
thanks for your help,
remove this topic if you wantthanks
Hi Karl,
No, problem. For auto width, leave the column’s width unset and it should work.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Peter, I tried leaving column width empty and it doesn’t work either? Am I missing something? This example has a single column and a button column. The grid is 300px wide, the button column is set to 50px but the first column ‘tradeid’ renderd at only 52px wide, i’d expect it to be approx 250px
$(“#jqxTrades”).jqxGrid(
{
source: tradeDataAdapter,
theme: theme,
width: 300,
autoheight: true,
editable: true,
editmode: ‘dblclick’,
sortable: true,
showsortcolumnbackground: false,
columns: [
{ text: ‘TradeId’, datafield: ‘TradeId’, hidden: true, editable: false },
{ text: ‘Trade’, datafield: ‘TradeName’, editable: true },
{
text: ”, datafield: ‘Delete’, width: 50, columntype: ‘button’, cellsrenderer: function () {
return “Delete”;
}, buttonclick: function (row) {
// get the clicked row’s data and initialize the input fields.
var dataRecord = $(“#jqxTrades”).jqxGrid(‘getrowdata’, row);
if (dataRecord.TradeName == “General”) {
//cannot delete
displayAlert(‘Sorry, Cannot delete “General” Trade’);
return;
}
$.ajax({
type: “POST”,
url: serviceURL + ‘/DeleteTrade’,
data: JSON.stringify({ TradeId: dataRecord.TradeId }),
contentType: “application/json; charset=utf-8”,
dataType: “json”,
processdata: true,
success: function (result) {
if (result == “OK”) {
$(‘#jqxTrades’).jqxGrid(‘deleterow’, $(‘#jqxTrades’).jqxGrid(‘getrowid’, row));
resetCache();
$(‘#’ + cmbTradeId).data(‘dataBind’)();
} else {
alert(result);
}
},
error: function (result) {
alert(“sorry an unexpected error occurred”);
}
});
}
}
]
});release note for 3.02 states this:
– Fixed an issue in jqxGrid regarding the column width calculation when the column’s width is not set.
so it seems functionality has changed in this version?
Hi Karl,
We fixed an issue regarding the width calculation and now it works better.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Thanks again for your input,
I’ve managed to further isolate the issue.
The issue occurs when using a remote data source and the previous column is hidden.
I’m guessing with remote data source and your change to column sizing may work differently with remote binding.
I cant attach files for a demo but simply change the column definitions in the demo bindingtojsonp.htm
columns: [
{ text: ‘Country Name’, datafield: ‘countryName’,hidden:true },
{ text: ‘City’, datafield: ‘name’},
{ text: ‘Population’, datafield: ‘population’, cellsformat: ‘f’, width: 170 },
{ text: ‘Continent Code’, datafield: ‘continentCode’, width: 100 }
]hiding first column and setting second to auto width fails in this case. if you show first column the second column does fill width.
my interim solution was simply to move my hidden column to last in list. having that hidden column at the start in conjuction with remote source is problematic.
Hi Karl,
Thanks for the feedback. If we verify your feedback, we will add a work item.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
I’m also trying to set auto column widths, but I noticed that the widths set are based only on the length of the header texts. Is there a way to set them based on the same calculation CSS uses for width=’auto’?
Hi elcarajo,
No, it is not possible to modify the calculation behavior.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.