保持表头固定在MVC [英] Keeping Table Header Fixed in MVC

查看:371
本文介绍了保持表头固定在MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,我需要保持固定的头。在code为表如下:

I have a Table for which I need to keep the header fixed. The code for the table is as below:

@Html.Grid(Model).Columns(column =>
{
     column.For(m => m.Id).Attributes(@class => "HideColumn").HeaderAttributes(@class => "HideHeader");                                   
     column.For(m => m.HolidayName).Named("Holiday Name").Attributes(@style => "width:300px;");
     column.For(m => m.HolidayDetails).Named("Holiday Details ").Attributes(@style => "width:300px;");
     column.For(m => m.Status).Named("Status").Attributes(@style => "width:200px;"); 
}

如何做到这一点?提前致谢。 :)

How to do this? Thanks in advance. :)

推荐答案

在电网MVC将呈现正常的HTML表(在我的理解,至少你使用MVC电网Nugets喜欢的 Grid.MVC )。所以,你可以使用任何HTML表格固定头jQuery插件来解决这个标题。

Grid in MVC will be rendering as normal HTML table (at least in my understanding you are using MVC Grid Nugets like Grid.MVC) on the client side. So you can use any HTML Table Fixed header JQuery plugins to fix the header.

一些选项,你所拥有的是 -

Some options what you have is -

<一个href=\"http://www.jqueryscript.net/demo/Simple-jQuery-Plugin-To-Freeze-Header-Row-In-Table-freezeheader/\"相对=nofollow> JQuery的FreezeHeader 中,你可以简单地有 -

JQuery FreezeHeader in which you can simply have -

 $(document).ready(function () {
            $("#tableid").freezeHeader();
        })

和一些选项 - 固定头表,的置顶表标题等。

And some more options are - Fixed Header Table, Sticky Table Headers etc.

这篇关于保持表头固定在MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆