gpt4 book ai didi

javascript - 如何在免费的 jqgrid 中增加表单编辑中的文本区域宽度

转载 作者:行者123 更新时间:2023-11-30 12:04:10 25 4
gpt4 key购买 nike

在最新的免费 jqgrid 中,textarea 用于内联和表单编辑。在内联编辑中,列宽应为 350px。这是在 colmodel 中指定的并且可以正常工作。

如何在表单编辑中增加 textarea 宽度超过 350px 以使其占据表单编辑窗口中的整个编辑列或具有更大的硬编码宽度?我尝试使用模板中的类属性仅在表单编辑中添加类,但类未添加到文本区域。

科尔模型:

{"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;
}

问题 how to restrict jqgrid textarea height in grid only和这个有点关系。

最佳答案

我想你可以通过添加 editoptions 的属性 cols: 20 来解决这个问题:

editoptions: { cols: 20 }

到具有 edittype: "textarea" 的列。

关于javascript - 如何在免费的 jqgrid 中增加表单编辑中的文本区域宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35733533/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com