Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Webgrid寻呼机在隐藏列Mvc4后消失_Javascript_Jquery_Asp.net Mvc 4 - Fatal编程技术网

Javascript Webgrid寻呼机在隐藏列Mvc4后消失

Javascript Webgrid寻呼机在隐藏列Mvc4后消失,javascript,jquery,asp.net-mvc-4,Javascript,Jquery,Asp.net Mvc 4,我在Mvc4中有一个Webgrid,我想在其中隐藏一列。 问题是,当我隐藏列时,分页正在消失,我不知道为什么 我的webgrid如下所示: @{ var grid = new WebGrid(canPage: true, canSort: true, rowsPerPage: 10, ajaxUpdateContainerId: "gridcontent

我在Mvc4中有一个Webgrid,我想在其中隐藏一列。 问题是,当我隐藏列时,分页正在消失,我不知道为什么

我的webgrid如下所示:

                                    @{
                                    var grid = new WebGrid(canPage: true, canSort: true, rowsPerPage: 10, ajaxUpdateContainerId: "gridcontent");
                                    grid.Bind(source: Model.Projects, rowCount: Model.RowCount, autoSortAndPage: false);
                                    grid.PageIndex = Model.ProjectPage;
                                    grid.SortColumn = Model.SortColumn;
                                    grid.SortDirection = Model.SortDirectionForColumn;
                                }

                                <div id="gridcontent">
                                    @grid.GetHtml(
                                    fillEmptyRows: false,
                                        tableStyle: "webgrid",
                                        headerStyle: "webgrid-header",
                                        footerStyle: "webgrid-footer",
                                        alternatingRowStyle: "webgrid-alternating-row",
                                        rowStyle: "webgrid-row-style",
                                        mode: WebGridPagerModes.All,
                                        htmlAttributes: new { id = "MainTable" },
                                        columns: grid.Columns(
                                            grid.Column("VsuProjectId", "Project Id"),
                                            grid.Column("ProjectName", " Project " + VsuWebPortal.Models.WebgridHelper.SortDirection(null, ref grid, "ProjectName"), style: "columnWidth"),
                                            grid.Column("CountryName", "Country", style: "columnWidth"),

                                            grid.Column("CustomerName", "Customer Name" style: "columnWidth"),
                                            grid.Column("CRMId", "CRM Id", style: "columnWidth"),

                                            grid.Column("MainProjectVersion", "Project Version", canSort: false, style: "columnwswithNotSortable")
                                            ))
我也尝试过使用Css,它确实隐藏了该列,但在分页时给出了相同的结果

table th:first-child, table td:first-child {
   display: none;
}

我没有找到它为什么会在页脚中隐藏分页,但我设法使它工作。 不知怎的,它只在我想隐藏第一列时才隐藏页脚。 因此,与其使用:

table th:first-child, table td:first-child {
  display: none;
}
我用过:

table td:nth-child(10), table th:nth-child(10) {
  display: none;
}
现在它工作得很好。 表中有一个隐藏列的原因是我单击整行时使用了该列:

$(function () {
var tr = $('#MainTable').find('tbody tr');
tr.live('hover', function () {
    $(this).toggleClass('clickable');
  }).live('click', function () {

      location.href = 'Whut/Details/' + $(this).find('td:nth-child(10)').text();

  });
});
$(function () {
var tr = $('#MainTable').find('tbody tr');
tr.live('hover', function () {
    $(this).toggleClass('clickable');
  }).live('click', function () {

      location.href = 'Whut/Details/' + $(this).find('td:nth-child(10)').text();

  });
});