tags:

views:

103

answers:

2

Hi,

I have a column that I want to display as a Text(e.g CityName) on read/display mode. 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.

Does jqGrid have this functionality out of the box or do I have to implement a custom formatter?

Thanks

+1  A: 

Got it already

Here is my solution

col Model

{ 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

}
Roy Astro
+1, thanks for sharing!
Justin Ethier
The problem with this solution is during edit mode jqgrid selects the option by name and not by id. So if you have a duplicate item it would point to the same name but wrong id.
Roy Astro
A: 

I have same problem, not any solution yet?

mehran
Please check the link it might help you out. http://www.trirand.com/blog/?page_id=393/help/edittype-select-with-a-dataurl-parameter-problem/#p19049
Roy Astro