PDA

View Full Version : JSON format for grid data



Krishna_tgkk
6 May 2010, 10:56 AM
Hi

I have a requirement to populate 2 grids in ext-js. I have a servlet which gets the results and convert the results in a proper JSON format for the Grid. I dont have any issues in populating JSON format for a single grid. I have only 1 servlet so what should be the JSON format in populating the 2 ext grids.

The catch in requirement is "only 1 servlet". I hope I am clear on my question.

Thank you

Krishna

Boxcopter
6 May 2010, 11:09 AM
You can always make 2 stores... if I understand you correctly. I simply call for the JSON strings using a different parameter.
Example:

url: 'localhost:8080/App/ServletName?Q=first'

url: 'localhost:8080/App/ServletName?Q=second'
In your servlet...

String query = request.getParameter("Q");
if(query.equals("first") { //code }
if(query.equals("second){ //code }
A simple if statement later you are getting two different JSON strings from the same servlet. If this isn't what you were looking for just let me know.