Column Definitions
The columnDefs.width argument let you adjust the column widths.
Note that the default value of style , or of autoWidth (defaults to True ), might override custom column widths,
so you might have to change their values as in the examples below.
You can set a fixed width for all the columns with "targets": "_all" :
This is the init_notebook_mode cell from ITables v2.9.0
(you should not see this message - is your notebook trusted ?)
Loading ITables v2.9.0 from the init_notebook_mode cell...
(need help ?)
ⓘ
region
country
capital
longitude
latitude
code
AW Latin America & Caribbean Aruba Oranjestad -70.016700 12.516700
AF South Asia Afghanistan Kabul 69.176100 34.522800
AO Sub-Saharan Africa Angola Luanda 13.242000 -8.811550
AL Europe & Central Asia Albania Tirane 19.817200 41.331700
AD Europe & Central Asia Andorra Andorra la Vella 1.521800 42.507500
AE Middle East & North Africa United Arab Emirates Abu Dhabi 54.370500 24.476400
AR Latin America & Caribbean Argentina Buenos Aires -58.417300 -34.611800
AM Europe & Central Asia Armenia Yerevan 44.509000 40.159600
AS East Asia & Pacific American Samoa Pago Pago -170.691000 -14.284600
AG Latin America & Caribbean Antigua and Barbuda Saint John's -61.845600 17.117500
(198 more rows not shown)
You can also adjust the width of selected columns only:
Loading ITables v2.9.0 from the init_notebook_mode cell...
(need help ?)
ⓘ
region
country
capital
longitude
latitude
code
AW Latin America & Caribbean Aruba Oranjestad -70.016700 12.516700
AF South Asia Afghanistan Kabul 69.176100 34.522800
AO Sub-Saharan Africa Angola Luanda 13.242000 -8.811550
AL Europe & Central Asia Albania Tirane 19.817200 41.331700
AD Europe & Central Asia Andorra Andorra la Vella 1.521800 42.507500
AE Middle East & North Africa United Arab Emirates Abu Dhabi 54.370500 24.476400
AR Latin America & Caribbean Argentina Buenos Aires -58.417300 -34.611800
AM Europe & Central Asia Armenia Yerevan 44.509000 40.159600
AS East Asia & Pacific American Samoa Pago Pago -170.691000 -14.284600
AG Latin America & Caribbean Antigua and Barbuda Saint John's -61.845600 17.117500
(198 more rows not shown)
If you wish you can also set a value for columnDefs permanently in itables.options as demonstrated in the cell alignment example below.
You can use the DataTables cell classes like dt-left , dt-center , dt-right etc. to set the cell alignment. Specify it for one table by using the columnDefs argument of show
Loading ITables v2.9.0 from the init_notebook_mode cell...
(need help ?)
ⓘ
region
country
capital
longitude
latitude
code
AW Latin America & Caribbean Aruba Oranjestad -70.016700 12.516700
AF South Asia Afghanistan Kabul 69.176100 34.522800
AO Sub-Saharan Africa Angola Luanda 13.242000 -8.811550
AL Europe & Central Asia Albania Tirane 19.817200 41.331700
AD Europe & Central Asia Andorra Andorra la Vella 1.521800 42.507500
AE Middle East & North Africa United Arab Emirates Abu Dhabi 54.370500 24.476400
AR Latin America & Caribbean Argentina Buenos Aires -58.417300 -34.611800
AM Europe & Central Asia Armenia Yerevan 44.509000 40.159600
AS East Asia & Pacific American Samoa Pago Pago -170.691000 -14.284600
AG Latin America & Caribbean Antigua and Barbuda Saint John's -61.845600 17.117500
(198 more rows not shown)
or globally by setting itables.options.columnDefs :
Loading ITables v2.9.0 from the init_notebook_mode cell...
(need help ?)
ⓘ
region
country
capital
longitude
latitude
code
AW Latin America & Caribbean Aruba Oranjestad -70.016700 12.516700
AF South Asia Afghanistan Kabul 69.176100 34.522800
AO Sub-Saharan Africa Angola Luanda 13.242000 -8.811550
AL Europe & Central Asia Albania Tirane 19.817200 41.331700
AD Europe & Central Asia Andorra Andorra la Vella 1.521800 42.507500
AE Middle East & North Africa United Arab Emirates Abu Dhabi 54.370500 24.476400
AR Latin America & Caribbean Argentina Buenos Aires -58.417300 -34.611800
AM Europe & Central Asia Armenia Yerevan 44.509000 40.159600
AS East Asia & Pacific American Samoa Pago Pago -170.691000 -14.284600
AG Latin America & Caribbean Antigua and Barbuda Saint John's -61.845600 17.117500
(198 more rows not shown)