how to show readonly fields in edit form in jqgrid or other way to show whole text from readonly column
jqGrid colModel包含使用以下属性定义的只读多行列。
内容行长度大于列宽,文本太长,因此工具无法显示其全部内容。无法看到全部内容。
我正在寻找一种允许用户查看整个列内容的方法。
例如,如果按下"编辑表单"按钮,则此列内容应在编辑表单中显示为只读文本区域。
但是,只读列不会以编辑形式出现。
如何允许用户查看整个列的内容?
1 2 3 4 5 6 | colModel: [{ "name":"LoggedLongText", "editable":false,"width":539, "classes":"jqgrid-readonlycolumn","fixed":true, "hidden":false,"searchoptions":{"sopt":["cn","eq","ne","lt","le","gt","ge","bw","ew","nc"]}} }] |
是设置
1 | editable: true, editoptions: { readonly:"readonly" } |
可能您需要什么?
更新:免费的jqGrid从4.8版开始支持
要显示只读字段,您可以尝试使用
另一种选择是使用自定义元素类型,该类型返回如下所示的跨度:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | colModel: [ ... {name:'price', ..., editable:true, edittype:'custom', editoptions:{custom_element: myelem, custom_value:myvalue} }, ... ] .. function myelem (value, options) { var el = document.createElement("span"); $(el).val(value); // be sure to escape special characters as necessary. return el; } function myvalue(elem, operation, value) { // just reutrun null or empty string. return""; } |
与使用"
使用跨度更好。有趣的是,jqGrid甚至将"不成功"表单控件发送到服务器。
希望这会有所帮助。
-jqr
要在EditForm上显示只读字段,必须尝试对jqGrid列使用editoptions内的