簡體   English   中英

如何在自由jqgrid中的表單編輯中增加textarea寬度

[英]How to increase textarea width in form edit in free jqgrid

在最新的免費jqgrid textarea用於內聯和表單編輯。 在內聯編輯列寬度應為350px。 這在colmodel中指定並且正常工作。

如何在350px以上的表格編輯中增加textarea寬度,使其占用表格編輯窗口中的整個編輯欄或具有更大的硬編碼寬度? 我試圖在模板中使用類屬性來僅在表單編輯中添加類,但是類沒有添加到textarea。

Colmodel:

{"template":MultiLineTemplate,
"name":"Avaldis",
"editoptions":{
  "class":"",
  "readonly":null
  },
"editrules":{"edithidden":true},
"editable":function(options){return getEditable(options,false);}
,"width":350
}

colmodel中使用的javascript:

var multilinePrefix = '<div class="jqgrid-multiline-cell">';
var MultiLineTemplate = {
    edittype: "textarea",
    searchoptions: { sopt: ["cn", "nc"] },
    formatter: function (v) {
        return multilinePrefix + (v == null ? '' : $.jgrid.htmlEncode(v)) + '</div>';
    },

    unformat: function (cellvalue) {
        return cellvalue;
    },

    editoptions: 
    {
        rows: 3,
        wrap: "off",
        style: 'overflow-x: hidden',
    }
};


function getEditable(options, isReadonly) {
    if (!isReadonly) {
        return true;
    }
    if (options.mode === "cell" || options.mode === "add" || options.mode === "edit") {
        return true;
    }
    return "readonly";
}

樣式:

.jqgrid-multiline-cell {
    max-height: 2.8em;
    overflow-x: hidden;
}

問題如何僅限制網格中的jqgrid textarea高度與此有一定關系。

我想你可以通過添加屬性cols: 20來解決問題cols: 20 editoptions

editoptions: { cols: 20 }

到具有edittype: "textarea"的列。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM