Roy Astro
Roy Astro

Reputation: 253

JQGrid Value and Text Column

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

Upvotes: 1

Views: 2054

Answers (1)

Roy Astro
Roy Astro

Reputation: 253

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

}

Upvotes: 4

Related Questions