开发者

Retrofitting jqGrid to a Velocity template under Tomcat?

开发者 https://www.devze.com 2023-03-31 17:45 出处:网络
I am new to JQuery and jqGrid.I have been successful in getting them to work well with a new ASP.Net MVC3 application I am creating.However, I wanted to retrofit jqGrid to a Tomcat/Java application th

I am new to JQuery and jqGrid. I have been successful in getting them to work well with a new ASP.Net MVC3 application I am creating. However, I wanted to retrofit jqGrid to a Tomcat/Java application that I took over management of (NOTE: but that I did not code) written back in 2005. This app uses a combination of JSP+Servlets+Services+Velocity on top of Tomcat 6.20. The page in question is a Velocity template that is backed by a POST to a servlet that is the talks to the service. I have jqGrid configured fine inside the template and it sets up properly on rendering.

Now, all I am trying to do for starters is not modify anything in the service that returns the "grid" search results. Ie, not wanting to have jqGrid post-back for data on render (just yet). The service returns a "search results" collection object that contains the search results data for the grid (and paginated based on some POST criteria) that Velocity can manipulate in the template. So, when the page is rendered by the Velocity engine, the data I seek is present, but locked up in the Sea开发者_运维百科rchResults collection. What I am unsure about is what approach I should take to pull that SearchResults collection into the jqGrid as it is rendered along with the page? The original HTML grid was built with a Velocity #for loop looping through the collection and building a TABLE structure with each "row's" attributes.

Eventually, if the client likes this much and approves the expense to integrate jqGrid more fully, I will modify the service to return JSON directly to the jqGrid and let the jqGrid handle the data as one would typically do with jqGrid's URL property, etc. But I need to sell it first and was hoping I could work the existing results collection in as a first step. Just new enough to JQuery and jqGrid to not be sure how to attack this in the least painful way as possible.

One thing I am adding is that I am not a Velocity expert. Only learned enough of it to maintain this package. My understanding is that Velocity renders the page first before it is then sent to the browser. So, it would seem that it could also render the <script> section for jqGrid and/or a data structure in the <script> section that could feed jqGrid's rows. Just not sure what that needs to look like in a locally supplied context. I have only worked with jqGrid's URL GET and POST.

0

精彩评论

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

关注公众号