EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: edus on June 12, 2014, 07:33:58 AM



Title: changing datagrid column title
Post by: edus on June 12, 2014, 07:33:58 AM
Hi , there is an option to retrieve the datagrid column title with getColumnOption, but how to change/update that propertie dinamicaly?

For example:
var col = $('#dg').datagrid('getColumnOption', field);
col.title = 'New Title'; - this does not work.

Thanks in advance.



Title: Re: changing datagrid column title
Post by: jarry on June 12, 2014, 03:12:28 PM
To update and apply column properties, you have to recreate datagrid with the new columns.
Code:
var dg = $('#dg');
var columns = dg.datagrid('options').columns;
columns[0][2].title = 'new title';  //change columns ...
dg.datagrid({columns:columns});  // recreate datagrid