先上效果:
最主要是在treegrid要加上“fit:true ”如果不加那么就会用diglog的滚动条,导致treegrid的头就没办法固定。
Code<div id="dlgSelectMenu" class="easyui-dialog" data-options="" style="width: 600px; height: 600px;" closed="true" > <table id="menuTreeGrid" class="easyui-treegrid" data-options=" url: '@Url.Action("GetAllMenusRetTreeGrid", "RestApi")', method: 'get', rownumbers: true, idField: 'id', treeField: 'text', fitColumns:'true', fit:true "> <thead> <tr> <th data-options="field:'id',hidden:'true'">id</th> <th data-options="field:'text'" width="150">@Html.LabelFor(model => model.MenuName)</th> <th data-options="field:'link'" width="150" >@Html.LabelFor(model => model.MenuLink)</th> <th data-options="field:'order'" width="70" >@Html.LabelFor(model => model.MenuOrder)</th> <th data-options="field:'visible'" width="50">@Html.LabelFor(model => model.IsVisible)</th> </tr> </thead> </table> </div>