如何将jqgrid列显示为下拉列表?

问题描述 投票:0回答:1

enter image description here

 $(function () {
 "use strict";
 $("#grid1").jqGrid({
 
 colModel: 
 name: "name", label: "Client", width: 53, editable: true, ellediting: true },
 {
 name: "invdate", label: "Date", width: 75, align: "center", orttype: date",
 formatter: "date", formatoptions: { newformat: "d-M-Y" }
 },
 {
 name: "amount", label: "Amount", width: 65, editable: true, ormatter: 'currency',
 formatoptions: { prefix: '$' }
 },
 {
 name: "State", label: "State", width: 41, editable: true, ellediting: true, edittype: "select",
 formatter: 'select', editoptions: {
 value: {
 1: 'Approve',
 2: 'Reject'
 }
 }
 },

我编写的代码为“状态”字段创建了一个下拉列表,其中包含“批准”和“拒绝”值。然而,下拉菜单最初并没有显示;它仅在我单击单元格时出现。

jqgrid dropdown
1个回答
0
投票

您使用它的方式是用于单元格编辑,当您单击单元格时会弹出。

要执行您想要的操作,您需要在加载数据后编辑所有单元格或提供您自己的 html 内容并保存选择。

正如想法一样,您可以在这里

寻找类似的内联编辑方法
© www.soinside.com 2019 - 2024. All rights reserved.