0

Como fazer para não quebrar em várias linhas as colunas de um <table>, pois coloquei um scroll e gostaria de deixar as células da grid sem quebra, e sim deixar o usuário usar o scroll.

inserir a descrição da imagem aqui

View Tabela

@model IEnumerable<Projeto.ERP.Model.Model.Cadastros.Pessoas.PessoaModel>
@using PagedList.Mvc;
@using PagedList;
@{
    ViewBag.Title = "GridViewMvc";
}

<h2>GridViewMvc</h2>

<div style="overflow: auto; width: 1140px">
    <table class="table table-striped table-bordered table-responsive table-hover">
        <thead>
            <tr>
                <th>
                    @Html.DisplayNameFor(model => model.Descricao)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.CPF)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.RG)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Logradouro)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Numero)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Complemento)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Bairro)
                </th>
                <th>
                    @Html.DisplayName("País")
                </th>
                <th>
                    @Html.DisplayName("Estado")
                </th>
                <th>
                    @Html.DisplayName("Cidade")
                </th>
                <th>
                    @Html.DisplayName("País")
                </th>
                <th>
                    @Html.DisplayName("Estado")
                </th>
                <th>
                    @Html.DisplayName("Cidade")
                </th>
            </tr>
        </thead>
        <tbody>

            @foreach (var registro in Model.ToList())
            {
            <th>
                @registro.Descricao
            </th>
            <th>
                @registro.CPF
            </th>
            <th>
                @registro.RG
            </th>
            <th>
                @registro.Logradouro
            </th>
            <th>
                @registro.Numero
            </th>
            <th>
                @registro.Complemento
            </th>
            <th>
                @registro.Bairro
            </th>
            <th>
                @registro.Pais.Descricao
            </th>
            <th>
                @registro.Estado.Descricao
            </th>
            <th>
                @registro.Cidade.Descricao
            </th>
            <th>
                @registro.Pais.Descricao
            </th>
            <th>
                @registro.Estado.Descricao
            </th>
            <th>
                @registro.Cidade.Descricao
            </th>
            }

            </tbody>
        </table>
        @if (ViewBag.PageCount > 1)
        {
            <div class="row">
                <div class="offset1 span10 font-small">
                    Pag: @(ViewBag.PageCount < ViewBag.PageNumber ? 0 : ViewBag.PageNumber) de @ViewBag.PageCount
                    @Html.PagedListPager((IPagedList)Model, page => Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, searchString = ViewBag.CurrentSearch }))
                </div>
            </div>
        }

    </div>

1 Resposta 1

0

Voce pode fazer isso utilizando CSS

table{
    white-space: nowrap;
}

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .