Telerik mvc 网格和固定宽度列
我的所有网格都会在第一列中包含一些用于编辑、删除和打开记录的图像链接。
我无法将此列固定为 80 像素。
这是我的代码:
@(Html.Telerik().Grid(Model)
.Name("Grid")
.DataKeys(keys => keys.Add(c => c.Handle))
.DataBinding(dataBinding => dataBinding
.Ajax()
.Select("AjaxPesquisar", "Especialidade")
.Update("AjaxAtualizar", "Especialidade")
.Delete("AjaxDelete", "Especialidade"))
.HtmlAttributes(new { @class = "grid-padrao" })
.ClientEvents(events => events
.OnDataBound("atualizarCss")
)
.Columns(columns =>
{
columns.Template(@<span><a class="formatacao" href="/Especialidade/Details/238" image="show"></a><a class="formatacao delete-link" href="/Especialidade/AjaxDelete/238" image="delete"></a><a class="formatacao" href="/Especialidade/Edit/238" image="edit"></a></span>).Width(80);
columns.Bound("Descricao").Title("Descrição");
columns.Bound("Handle").Title("Código");
})
.Pageable()
.Sortable()
)
all my grids will have in the first column, some image links to edit, delete and open the record.
I can't get this column to be fixed at 80 pixels.
Here is my code:
@(Html.Telerik().Grid(Model)
.Name("Grid")
.DataKeys(keys => keys.Add(c => c.Handle))
.DataBinding(dataBinding => dataBinding
.Ajax()
.Select("AjaxPesquisar", "Especialidade")
.Update("AjaxAtualizar", "Especialidade")
.Delete("AjaxDelete", "Especialidade"))
.HtmlAttributes(new { @class = "grid-padrao" })
.ClientEvents(events => events
.OnDataBound("atualizarCss")
)
.Columns(columns =>
{
columns.Template(@<span><a class="formatacao" href="/Especialidade/Details/238" image="show"></a><a class="formatacao delete-link" href="/Especialidade/AjaxDelete/238" image="delete"></a><a class="formatacao" href="/Especialidade/Edit/238" image="edit"></a></span>).Width(80);
columns.Bound("Descricao").Title("Descrição");
columns.Bound("Handle").Title("Código");
})
.Pageable()
.Sortable()
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果表格的
table-layout
CSS 设置设置为fixed
,则列宽效果最佳。您可以使网格 Scrollable() 或使用以下 CSS:您可以在 此处找到有关表格的更多信息。
Column widths work best if the
table-layout
CSS setting of the table is set tofixed
. You can either make your grid Scrollable() or use the following CSS:You can find more info about tables here.
我也有同样的问题!为了让它工作,我所做的就是添加:
希望这有帮助。
I have the same issue too! What I did to get it work is to add:
Hope this helps.