6

width プロパティを使用して狭めた幅の広い jqgrid があります。それを使用すると、水平スクロールバーが表示されなくなりました。どうすればそれを示すことができますか?

どんな助けでも大歓迎です、

ありがとう

ハイメ

編集:

これは私が持っている現在のJSコードです。スクロールバーはまだ表示されていません:

<script type="text/javascript">
$(function () {
    $("#personal").jqGrid({
        url: "@Url.Action("List")",
        datatype: "json",
        mtype: "GET",
        colNames: ["Departamento",
                   "Nombres",
                   "Apellido Paterno",
                   "Apellido Materno",
                   "RUT",
                   "Contraseña",
                   "Fecha Nacimiento",
                   "Fotografía",
                   "Estado Civil",
                   "Género",
                   "Dirección",
                   "Cargo",
                   "E-mail",
                   "Fecha Ingreso",
                   "Creación",
                   "Modificación",
                   " "],
        colModel: [
            { name: "departamento", index: "dep_nombre", editable: true, edittype: "select", editoptions: { width: 100, dataUrl: "@Url.Action("GetDepartments","Departamento")" }, width: 250, editrules: { required: true } },
            { name: "per_nombres", index: "per_nombres", editable: true, width: 250, editoptions: { maxlength: 80, size: 32 }, editrules:{ required:true } },
            { name: "per_apellido_paterno", index: "per_apellido_paterno", editable: true, width: 250, editoptions: { maxlength: 80, size: 32 }, editrules: { required: true } },
            { name: "per_apellido_materno", index: "per_apellido_materno", editable: true, width: 250, editoptions: { maxlength: 80, size: 32 } },
            { name: "per_dni", index: "per_dni", editable: true, width: 100, editoptions: { maxlength: 20, size: 17 }, editrules: { required: true } },
            { name: "per_contrasena", editable: true, width: 100, editoptions: { maxlength: 50, size: 17 }, editrules: { required: false } },
            { name: "per_fecha_nacimiento", index: "per_fecha_nacimiento", editable: true, width: 100, editrules: { date: true }, formatter: 'date', formatoptions: {srcformat: 'SortableDateTime', newformat: 'd-m-Y'}, editoptions: { size: 17, dataInit: function (el) { $(el).datepicker({ dateFormat: 'dd-mm-yy' }); } }, },
            { name: "per_fotografia", index: "per_fotografia", editable: true, width: 250, edittype: "file", editoptions: { maxlength: 255, size: 32 } },
            { name: "per_estado_civil", index: "per_estado_civil", editable: true, edittype: "select", editoptions: { value: "S:Soltero; C:Casado; V:Viudo; D:Divorciado" }, width: 100 },
            { name: "per_sexo", index: "per_sexo", editable: true, edittype: "select", editoptions: { value: "M:Masculino; F:Femenino" }, width: 100 },
            { name: "per_direccion", index: "per_direccion", editable: true, width: 250, editoptions: { maxlength: 512, size: 32 } },
            { name: "per_cargo", index: "per_cargo", editable: true, width: 100, editoptions: { maxlength: 50, size: 32 } },
            { name: "per_email", index: "per_email", editable: true, width: 100, editoptions: { maxlength: 80, size: 32 }, editrules: { email: true } },
            { name: "per_fecha_ingreso", index: "per_fecha_ingreso", editable: true, width: 100, editrules: { date: true }, formatter: 'date', formatoptions: {srcformat: 'SortableDateTime', newformat: 'd-m-Y'}, editoptions: { size: 17, dataInit: function (el) { $(el).datepicker({ dateFormat: 'dd-mm-yy' }); } }, },
            { name: "per_creado_el", index: "per_creado_el", editable:false, search:false, width: 100, align: "center", formatter: "date" },
            { name: "per_modificado_el", index: "per_modificado_el", editable:false, search:false, width: 100, align: "center", formatter: "date" },
            { name: 'acciones', width: 58, fixed: true, sortable: false, resize: false, search:false, formatter: 'actions', formatoptions: { keys: true } }
        ],
        jsonReader: {
            repeatitems: false,
            id: "per_id"
        },
        pager: "#pager",
        rowNum: 10,
        rowList: [10, 20, 30],
        sortname: "per_apellido_paterno",
        sortorder: "asc",
        viewrecords: true,
        gridview: true,
        autoencode: true,
        multiselect: true,
        shrinkToFit: false,
        caption: "Funcionarios",
        editurl: "@Url.Action("AjaxEdit")",
        height: '100%',
        width: 935,
        rownumbers: true,
        rownumWidth: 40            
    });

    $("#personal").jqGrid('hideCol', ["per_contrasena", "per_fotografia", "per_direccion"]);
    $("#personal").jqGrid('navGrid', '#pager', { edit: false, add: true, del: true, search: false }, { width: 500 }, { width: 500 }, {}, { multipleSearch: false, multipleGroup: false });
    $("#personal").jqGrid('filterToolbar', { searchOperators: false });

    $.jgrid.edit.addCaption = "Agregar Funcionario o Visita";
    $.jgrid.edit.editCaption = "Modificar Funcionario o Visita";
    $.jgrid.edit.saveData = "¡El funcionario fue modificado! ¿Almacena los cambios?";

    $.jgrid.formatter.date.newformat = 'd-m-Y H:i';
}); 
</script>
4

7 に答える 7

10

コードがなければ、いくつか確認する必要があります...

使用しないでください。使用autowidthしていないことを確認してくださいshrinkToFit(false に設定する必要があります)。それ以外では、水平スクロールバーはこれら 2 つの変更だけで表示されるはずです。これに加えて、列モデル内の各列の幅を明示的に設定する必要もあります。

于 2013-06-01T19:03:50.847 に答える
4

テーブルの周りに幅とoverflow:autoを備えたdivを追加すると、うまくいくはずです。

<div style="width:100px;overflow:auto;"><table id="personal"></table><div>
于 2013-06-01T23:10:46.193 に答える
4

追加するだけ

 shrinkToFit : false,

セルサイズがテーブルの親幅/

于 2014-03-26T08:54:37.743 に答える
3

水平スクロールバーは、次の条件でうまく機能します。

  1. shrinkToFitパラメータと を設定しますforceFit。例えば:

    $('#gridObtenerRegistros').jqGrid({ shrinkToFit:false, forceFit:true,

    width パラメータを使用しないでください。

  2. 内で width プロパティを設定しますcolmodel。例:

    colModel:[ {name:'numEmpleadoCliente',index:'numEmpleadoCliente', width:80, sortable: false, resizable: false}, {name:'nombre',index:'nombre', width:215, sortable: false, resizable: false}, {name:'estatus',index:'estatus', width:50, sortable: false, resizable: false}],

  3. クラスのスタイルをチェックし.ui-jqgrid .ui-jqgrid-bdivています:`

    overflow: auto;

  4. グリッドのテーブルをチェックすると、幅のプロパティがありません。

    私の例では: <table id="gridBusquedaRegistros"></table>

これが誰にも役立つことを願っています。

于 2014-08-26T23:22:18.820 に答える
0

ページに別の CSS が定義されていて、問題が発生している可能性があります。コードを使用するだけのデモでは、水平スクロールバーが表示されます。

于 2013-06-02T14:49:35.817 に答える