Reputation: 2969
so, I have this column definition for my ui-grid
columnDefs: [
{ name: 'Usr#', field: 'userNum', width: '*', resizable: true},
{ name: 'Name', field: 'userName', width: '*', resizable: true},
{ name: 'PID', field: 'userPID', width: '*', resizable: true},
{ name: 'Flags', field: 'userFlags', width: '*', resizable: true},
{ name: 'Blk Acc', field: 'dbAccess', width: '*', resizable: true},
{ name: 'OS Rd', field: 'osReads', width: '*', resizable: true},
{ name: 'OS Wr', field: 'osWrites', width: '*', resizable: true},
{ name: 'Hit%', field: 'hitRatio', width: '*', resizable: true},
{ name: 'Rec Lck', field: 'recLks', width: '*', resizable: true},
{ name: 'Rec Wts', field: 'recWts', width: '*', resizable: true},
{ name: 'Line#', field: 'lineNum', width: '*', resizable: true},
{ name: 'Program Name', field: 'procName', width: '*', resizable: true},
]
and I have this grid :
ui-grid is being friendly and trying to format the column headers for me - but I don't want it to ;)
how can / do I turn this option off ?
Also, is it possible to set a column to auto-fit the width of the largest data item ?
Upvotes: 3
Views: 964
Reputation: 134
A workaround to no have your header reformatted is to use the displayName field: For instance:
columnDefs: [
...
{ name: 'PID', displayName: 'PID', field: 'userPID', width: '*', resizable: true},
...
Upvotes: 4