使用Struts2 jQuery插件在Dialog中填充下拉列表 [英] Populate dropdown list inside Dialog using Struts2 jQuery Plugin

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

问题描述

我有一个Dialog,我必须在其中填充数据库的下拉列表。我正在使用struts2-juery-plugins来实现Dialog.This Dialog在某些事件上打开。这就是我创建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" />

但是列表没有填充, Dialog jsonData填充如下

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插件在Dialog中填充下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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