简体   繁体   中英

Static Dropdown in Jqgrid edit popup

I am using jqgrid for basic CRUD functionality on an asp.net mvc page. My requirement is that I want to show a dropdown on edit popup that will only contain static values eg New and Existing. All the examples I find use editoptions with dataurl and buildselect method. Is there a way that I can build select list using static values when grid opens?

Thanks

It's very simple. You need just use value property of editoptions . Something like

{ name: "myColName", width: 100, editable: true, edittype: "select",
    editoptions: { value: "New:New;Existing:Existing", defaultValue: "New" }}

or if you use toolbar searching additionally then

{ name: "myColName", width: 100, editable: true, edittype: "select", stype: 'select',
    editoptions: { value: "New:New;Existing:Existing", defaultValue: "New" },
    searchoptions: { sopt: ['eq', 'ne'], value: ':Any;New:New;Existing:Existing' }}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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