EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: btork on May 22, 2025, 05:14:20 PM



Title: Change background-color of entire column
Post by: btork on May 22, 2025, 05:14:20 PM
How do I change the background color for a column?


Title: Re: Change background-color of entire column
Post by: jarry on May 24, 2025, 06:21:35 AM
Define the 'styler' function to set the CSS styles for the column.

Code:
    <script>
        function mystyler(){
            return 'background:#ddd'
        }
    </script>
<table id="tg" title="Folder Browser" class="easyui-treegrid" style="width:700px;height:250px"
data-options="
data:data,
rownumbers: true,
idField: 'id',
treeField: 'name'
">
<thead>
<tr>
<th data-options="field:'name',styler:mystyler" width="220">Name</th>
<th data-options="field:'size'" width="100" align="right">Size</th>
<th data-options="field:'date'" width="150">Modified Date</th>
</tr>
</thead>
</table>