Pages

Thursday, June 25, 2009

DOJO and DWR: Filtering Select

Allright, I was working with dojo in the past few months ago and looking back to the source code I think I should at least blog something about it just to remind me about what I have done for the previous project. Today, I am going to blog about how to retrieve data from the database and display in the "Dojo Filtering Select." and this is how it works. For me, I am using JSP, JAVA,DWR and javascripts as my development framework. First of all you may need to understand how to install the "Dojo Toolkit" and DWR in your machine. I am not going for detail on this and you may want to refer to the link for details: http://tinyurl.com/ndenr2 and http://tinyurl.com/6ouod9.

The following is the example of jsp page that show the filtering select in the page:



The piece of code is placed at a jsp file called "menu.jsp" and as you can see from the above code, there is a parameter called "id" and that is what it is gonna use to assign all your data that will retrieve from the database. Don't forget to import the javascript to the main jsp file. For example, I will call my javascripts as the filteringSelectLoad.js and this is how I import to the main jsp page:



The following is the javascripts that did the job or passing and getting data from the back end.



Well, as you can see from the code for MenuManager.getMenu(menu, populateMenu), the MenuManager is where you got to declare @ the dwr.xml. Once you got retrieve the data with dwr and pass back to the front end. Basically, that is all did the job of retrieving and display data in the filtering select. If you wish to know how to retrive data with dwr, you may want to check out :
http://tinyurl.com/n9ezrb

Hope this help!

-Kay Nny-

No comments:

Post a Comment