简体   繁体   English

JQGrid值和文本列

[英]JQGrid Value and Text Column

I have a column that I want to display as a Text(eg CityName) on read/display mode. 我有一个列,我想在读/显示模式下显示为文本(例如CityName)。 When the user clicks edit, I want it to be displayed as a Select, i would then pass the CityID so that I can display the Select Control with options==CityID as selected. 当用户单击编辑时,我希望它显示为选择,然后我将传递CityID,以便我可以显示选择控件选项== CityID作为选中。

Does jqGrid have this functionality out of the box or do I have to implement a custom formatter? jqGrid是否具有开箱即用的功能,还是我必须实现自定义格式化程序?

Thanks 谢谢

Got it already 已经知道了

Here is my solution 这是我的解决方案

col Model col模型

{ name: 'CityID', index: 'CityID', width: 55, editable: true, edittype: 'select',  editoptions: { dataUrl: 'City/GenerateCityOptions' }, formatter: CityFormatter},

function CityFormatter(cellvalue, options, rowObject) {

    return rowObject.CityName; //The field name that i wanted to be displayed instead of id

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM