开发者

unable to show the Data into the FilteringSelect DOJO Component using ItemFileReadStore

I am unable to show the Data into the FilteringSelect DJO Component using ItemFileReadStore . Please help

<html>
<head>

   <link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"/>

 <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"
djConfig="parseOnLoad: true">
 </script>
<script>

dojo.require("dijit.form.DateTextBox");
dojo.require("dojox.layout.TableContainer");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.FilteringSelect"); 
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.form.ComboBox");

</script>
<script>

function callMe()
{


}

</script>
  </head>
  <body class="claro">

<div dojoType="dojo.data.ItemFileReadStore" jsId="orgStore"  url="http://localhost:8099/Hi/My开发者_运维问答Servlet"></div>
<div dojoType="dijit.form.FilteringSelect" id="selectaccount" store="orgStore"   name="groupId" id="groupId" label="Select Account:"  >MyCombo</div>
</body>
</html>

This is my servlet Program :

import org.json.JSONObject;


public class MyServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("Saiiiiiiiiiiiiii");
          response.setContentType("text/x-json;charset=UTF-8");           
            response.setHeader("Cache-Control", "no-cache");

        List list = new ArrayList();

        for(int i =0 ;i<=10;i++)
        {
            list.add("Test");
        }

         JSONObject json =  new JSONObject();
         response.getWriter().write(json.toString());


    }



}


Your servlet should output json data in the following format:

{
   label : "name",
   items : [
       {name : "Name1"},
       {name : "Name2"}
   ]
}

Use the JSON library you used in the servlet to generate this kind of json data.

After that, specify the searchAttr attribute of dijit.form.FilteringSelect to tell it to filter on this attribute in the store.

<div dojoType="dijit.form.FilteringSelect" id="selectaccount" store="orgStore"   name="groupId" id="groupId" searchAttr="name" label="Select Account:"  >MyCombo</div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜