views:

24

answers:

1

First, i have to declare myself that, i dont know PHP & AJAX. I know something in DWR, javaScript & java, like i am able to create a Web based CRUD by using them. I want to integrate DWR & JAVA with the jQGrid. I did a lot of research for that. I am not able to find anything that uses JAVA & DWR in jqGrid.

Any conceptual idea or solution will be appreciative. Any online links will be more appreciative.

Thanks in advance.

+1  A: 

You asked about conceptual idea of a possible solution. I try shortly describe a possible way. How I could understend from your previous question you are a beginner in JavaScript and jQuery. So I try to write simple and clear describe the arcitectur of the solution.

Your Web application can consist of pure HTML or XHTML pages (without any JSP pages) with Javascript files loaded and started throght <script type="text/javascript" src="..."></script>. You place HTML/XHTML markup in your *.htm files and the definition of jqGrid in *.js files.

jqGrid has three important parameter mtype which are typically "GET" or "POST", datatype withe the values like "xml" or "json" and url parameter. This three parameters defins how the grid will be filled. There are also editurl cwich are used for CRUD operations. So you can implement a servlet in Java (see http://stackoverflow.com/questions/773508/how-to-learn-ajax-using-jquery-in-a-java-web-app for example) which could be the only active component in your solution which bound to the URL defined by url and editurl and support HTTP GET or POST depend of your mtype choice. It will work like a web service which provide the data for the jqGrids and implement all CRUD operations.

jqGrid will send to servlet some standard parameters. The names of this input parameters of the servlet you can change with prmNames parameter of jqGrid (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options). The most important parameters of the servlet method are following int page, int rows, string sidx, string sord. Adfditional parameters could be also bool _search, string searchField, string searchOper, string searchString if you want to use single searching in th jqGrid or bool _search, string filters in case of advanced searching. So it user click on the "next page" jqGrid button or click on the grids column header to sort the data, your servlet will by called by jqGrid with the corresponding values of the imput parameters.

In the way you have clear structure of your solution. I am not sure that you will need DWR. Just try to find how you can use jQuery.ajax to call your Java servlets. If you will have some problems with implemented the same technique inside of jqGrid you can customize jQuery.ajax requests which will be send by jqGrid with ajaxGridOptions jqGrid parameter. You can also use serializeGridData event of jqGrid (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events#list_of_events) to implement any data conevrsion before the data will be snd to the servlet and use use jsonReader or xmlReader (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data) which define how the data returned from the server should be readed by jqGrid.

Oleg
Thanks for your reply. Its also useful to me. But i made it with the help of my Boss. Its now more simlpe man. I did server side process with DWR and left the client side process to already made JqGrid. Its working great. But i could use your answer for my future reference. It worths.
NooBDevelopeR