【问题标题】:need help to solve struts2 drop down in jquery grid issues需要帮助解决 jquery 网格问题中的 struts2 下拉问题
【发布时间】:2012-10-29 18:39:20
【问题描述】:

在我的编辑网格功能中,我的下拉菜单无法填充数据,即使我正在查看此线程 http://www.trirand.com/blog/?p.....-questions,我仍然无法解决。所以我需要你的帮助,因为我是新手。 基本上在我的 Action 课上

 public class CategoryAction extends ActionSupport {
private static final long serialVersionUID = 3643090482804105068L;
private List<String> category;    
public String execute() throws Exception{            
    generalDelegate util = new generalDelegate();    
    category = util.retrieveCategory();
    System.out.println("+++++++++");
    return "success";
}
public List<String> getCategory() {
    return category;
    }
   }

类别返回以下结果[牙膏、沐浴露、洗发水、剃须膏、洗手液、洗面奶、美发] 在我的 Struts.xml 中

<action name="jsonCategoryAction" class="general.CategoryAction"> 
        <result type="json" name="success">Category.jsp</result> 
    </action>  

最后是我的 Main.jsp

                <s:url id="selectCategoryUrl" action="jsonCategoryAction" />
                                    <sjg:gridColumn 
                                        name="category1″ 
                                        index="category1″ 
                                        title="Item Category" 
                                        sortable="true"
                                        editable="true"
                                        edittype="select" 
                                        editoptions="{ dataUrl : '%{selectCategoryUrl}' }" />  

请指导我哪里出错了……非常感谢

【问题讨论】:

  • 尽量不要使用comma,而是使用semicolon来分隔选项

标签: struts2 struts2-jquery jqgrid


【解决方案1】:

请阅读文档

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:common_rules#editoptions

dataUrl

    The data is obtained via an AJAX call and should be a valid HTML
    select element with the desired options <select><option
    value='1'>One</option>…</select>. You can use option group.

所以你的 ajax 请求必须返回一个有效的 html 选择元素。

【讨论】:

  • 这并不是我想要的答案。但无论如何我通过谷歌搜索解决了它......谢谢昆西
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-11-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多