【问题标题】:How to add Select Box In Edit Row in Jqgid?如何在 Jqgid 的编辑行中添加选择框?
【发布时间】:2012-10-26 06:10:37
【问题描述】:

我正在使用 jqgrid。我想添加记录内联导航 现在我想在行字段中添加选择框。 怎么可能? 我使用 Ajax 从数据库中获取数据,我想将这些数据添加到选择框中。 怎么可能? 请帮忙 我的 Ajax 代码

$.ajax({
 url : "getAllWards.html",
 data : "&time=" + new Date().getTime(),
 type : 'GET',
 dataType : 'JSON',
 success : function(data) {}
});

我的 JqGrid 代码

jQuery("#room").jqGrid(
{
 mtype : 'GET',
 url : "listAllRooms.html",
 colModel : [ .....,
 ,{
name : 'wardType',
index : 'wardType',
width : 150,
edittype: "select",
editrules: { required: true },
editoptions: { size: 71},
editable:true,
}],

【问题讨论】:

  • @Oleg 请帮助如何在选择框中添加动态数据
  • @oleg 上面的问题是解决 jQuery("#room").jqGrid('setColProp','wardType', { editoptions: { value: wardTypes} });其中 wardTypes 是使用 Ajax 从数据库中获取的变量现在我想将 set ward id 添加到其 Optionvalue 并将 wardType 添加到 option.SO 它如何?
  • 我在发布答案后才看到第二条评论。所以 1) 如果你想给我发送通知,你应该在我的一些 previous answer 中用“@Oleg”写评论。如果您发布新问题“@Oleg”无法解决。对于同名的不同用户,请参阅here
  • 在我看来,您最好使用dataUrlbuildSelect 进行格式化。见the answerhere

标签: ajax jquery jqgrid jqgrid-inlinenav


【解决方案1】:

如果您想使用edittype: "select",您应该指定editoptionsvaluedataUrl 属性。

The demo 提供示例。

更新:在我看来,您最好使用dataUrlbuildSelect 进行格式化。请参阅the answeranother one

【讨论】:

  • 在 dataUrl 代码中 Url = ?是 My Ajax Url 和 GetDestinationList= 吗?
  • @AshuMehta:抱歉,我不明白你的意思。如果您使用 ASP.NET,您应该阅读the answer 或下载我提供的演示项目。
  • 我有 wardId 和 wardName 两个字段,这两个字段要在
  • 通过使用 Ajax 我得到 Id 和类型
  • 现在这些'id'设置在jqgrid选择框值和'Type'设置在
猜你喜欢
  • 1970-01-01
  • 2017-04-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-03
相关资源
最近更新 更多