使用 Struts2 jQuery 插件填充对话框内的下拉列表 [英] Populate dropdown list inside Dialog using Struts2 jQuery Plugin

查看:26
本文介绍了使用 Struts2 jQuery 插件填充对话框内的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个对话框,我必须从数据库中填充一个下拉列表.我正在使用 struts2-juery-plugins 来实现对话框.此对话框在某些事件上打开.这就是我创建 Dialog 的方式.

I have a Dialog in which I have to populate a dropdown list from database.I am using struts2-juery-plugins to implement Dialog.This Dialog is open on some event. This is how I create Dialog .

<sj:dialog 
     id="mybuttondialog"
     href="%{fillUser}"
     buttons="{
            'Assign':function() { approoveButton(); },
            'Deny':function() { denyButton(); }
            }"
     autoOpen="false"
     modal="true"
     title="Assign-Task"
     closeTopics="closeThisDialog">
<label>User</label>
  <select id="userCombo" name="userCombo">
    <s:iterator value="userList">
      <option><s:property value="helper_name" /></option>
    </s:iterator>
  </select>    
</sj:dialog>

我正在调用一个动作来使用

I am calling an action to fill dropdown list using

<s:url var="fillUser" action="getAllUsers" />

但列表未填充,DialogjsonData 填充,如下所示

But list is not populating and Dialog got filled with jsonData as following

{"helpDeskUsers":"success","userList":
[{"departments":null,"helper_name":"arvin","helper_value":null,"user_level":null},
{"departments":null,"helper_name":"anand","helper_value":null,"user_level":null},
{"departments":null,"helper_name":"Nehal","helper_value":null,"user_level":null},

为什么列表没有填充,而是整个 Dailog 都填充了上述数据.任何帮助都会很棒.

Why list is not populating instead whole Dailog is filled with above data. Any help would be great.

推荐答案

<select 标签不能用于 json 列表,你应该使用类似

The <select tag will not work with json list, you should use something like

<s:url var="fillUser" action="getAllUsers" />
<sj:select
  id="userjson"
  name="users"
  href="%{fillUser}"
  list="userList"
  listValue="helper_name"
  listKey="helper_name"

这篇关于使用 Struts2 jQuery 插件填充对话框内的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆