在jqgrid中,是否可以在不设置editoptions的情况下使用select formatter?

在jqgrid中,是否可以在不设置editoptions的情况下使用select formatter?,jqgrid,jqgrid-formatter,Jqgrid,Jqgrid Formatter,由于我的jqgrid列之一是不可编辑的,所以我没有将必需的值信息,即{value:“1:John;2:Smith”}设置为editoptions,而是将formatter:select和value info设置为formattoptions。当我查看selectformatter的js源代码时,它与editoptions紧密地结合在一起,特别是为了获得它的“multiple”属性。不编写自定义格式化程序就可以实现这一点吗 formatter:select formatoptions:{value

由于我的jqgrid列之一是不可编辑的,所以我没有将必需的值信息,即{value:“1:John;2:Smith”}设置为editoptions,而是将formatter:select和value info设置为formattoptions。当我查看selectformatter的js源代码时,它与editoptions紧密地结合在一起,特别是为了获得它的“multiple”属性。不编写自定义格式化程序就可以实现这一点吗

formatter:select
formatoptions:{value:"1:John;2:Smith"}
发送到此列的数据是“1”或“2”,我希望jqGrid显示John或Smith

谢谢,
Alper.

您是对的,的代码可以改进为使用
opts.colModel.formatoptions.multiple
,方式与在中使用的方式相同

尽管如此,我认为这不是一个真正的问题。如果列中没有
editable
属性,或者如果列中有
editable:false
属性,则即使使用
editoptions
,列仍保持不可编辑状态


因此,我同意您使用
formatoptions.multiple
会更好,但我认为这只是“幸好”的问题。

好吧,在某种程度上可以实现上述情况,但对于逻辑分离,这应该得到处理,否则会造成混乱。源代码中还有其他可能导致混淆的情况,例如“本地”、“客户端阵列”概念。实际上,我更改了原始格式化程序,以约定的方式处理它,因为使用其他sol'n我感到不舒服。