Aug. 11th, 2015

There is very nice web component for tabular data - jqGrid http://www.trirand.com/blog/

When I had to use it with Spring and Hibernate, I found several tutorials on how to do that.

http://krams915.blogspot.com.au/2012/01/spring-mvc-31-jqgrid-and-spring-data_8761.html
http://krams915.blogspot.com.au/2010/12/jqgrid-and-spring-3-mvc-integration.html
http://nisargpathak.blogspot.com.au/2014/02/spring-mvc-with-jqgrid-simplified.html

But neither of them can make use of filtering jqGrid feature. So I will decribe how to add filtering to abovementioned example of krams915.

First, we introduce JqGridSearchField class. It is fairly simple POJO that represents one filtering condition and has method criterion() that returns condition as org.hibernate.criterion.Criterion
ExpandRead more... )
Now, we can add JqGridSearch template.
ExpandRead more... )
We use it as parent for classes like JqGridSearchUser.
ExpandRead more... )
Now JqGridSearchStaffPositionElem has class info on User. User is hibernate Entity and we can easily map it on DB.

JqGridSearch will take care of both transient and non transient fields.

Now all filtering is done by this snippet
ExpandRead more... )

Profile

vashu11

December 2024

S M T W T F S
12 34567
891011121314
15161718192021
22232425262728
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

Expand All Cut TagsCollapse All Cut Tags
Page generated Jul. 8th, 2025 05:23 am
Powered by Dreamwidth Studios