Why would you use postJSON for such a task? And, you haven't really said anything about what you are trying to do or what problems you are having. Also, please do not post JSP markup in an HTML forum -- it's meaningless in this context.
Please put as much effort into making your posts as you would like people to take in answering them.
My technology stack consists of Spring MVC 3.0 and it has a lot of support for postJSON. I have used a combination of jQuery/postJSON for some transactions like displaying combobox downdrop values and such.
Using the same wiring I was able to load data from the server into the client for loaded my jQuery datatable which already has preloaded data but I was unable to update the Spring items in the table and refreshing the table with new values.
Jay Abrahm wrote:My technology stack consists of Spring MVC 3.0 and it has a lot of support for postJSON. I have used a combination of jQuery/postJSON for some transactions like displaying combobox downdrop values and such.
Just because there is a lot of support for something, doesn't mean you should go out of your way to use it. Using postJSON for something like select values (HTML has no such thing as a dropdown) makes sense. Simple key/value pairs of data. But for something more complex, like a table, it is a lot easier to return HTML fragments. For example, on an application I am working on I have a table...
I issue an Ajax request to the server where my controller simply forwards the request to the JSP that renders my table row:
Then I just use the jQuery's append() method to add it to my TBODY element. Really simple and zero manual processing of data on the client. If you're needs a more complex then I highly recommend something like jqGrid.
@ Gregg Bolinger -- Thanks, I did just that. jQuery build up html fragments. I just need to clear up some bugs in the code and I should be all good.
1. After adding new rows the html table is no longer recognized as a data table.
2. If I duplicate the datatable initialization code, I get a error message that it is already initialized.
3. I need to add logic to add new rows (which I dont think is too difficult)
Ahhhh, new information. Are you using a dataTable plugin? If so, then absolutely adding rows to it might make it not work. The plugin should have a means for you to add rows through it's API. If it doesn't then you need to find a better plugin.
Joined: May 28, 2008
Its not that I withheld info :-). I just started using it then since it had a feature that I was looking for (a slick search on table data).