EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Xiaolin on July 24, 2011, 08:59:21 AM



Title: datagrid column title
Post by: Xiaolin on July 24, 2011, 08:59:21 AM
How can we get the datagrid column title? For example:
<table class="easyui-datagrid">
    <thead>
        <tr>
            <th field="Name" width="60">Name</th>
            <th field="Sex" width="35">Sex</th>
        </tr>
    </thead>
</table>
How can we get the "Name" and "Sex" text? Thanks in advance.


Title: Re: datagrid column title
Post by: stworthy on July 24, 2011, 06:09:35 PM
var fieldName = 'Name'; // the field name
var opts = $('#tt').datagrid('getColumnOption',fieldName);  // get the specified column option
alert(opts.title);  // the title to display


Title: Re: datagrid column title
Post by: Xiaolin on July 25, 2011, 06:48:53 AM
Got it, thank you very much!