My favorites | Sign in
Project Home Wiki Issues
Project Information
Members
Links

The bsGrid is designed to simplify the creation of data tables without dealing much with the HTML, Javascript or CSS. The bsGrid gives front-end visualization with HTML, Javascript, CSS, jQuery and an external library Supertables by Matt.

The following is the list of functionalities bsGrid provides as of now.
  • Searching
  • Column Sorting
  • Column Freezing
  • Pagination
  • Servlet wrapper
  • Data Export

The bsGrid is divided into two parts: HTML/Javascript and Servlet.

The HTML/Javascript part does all the server communication and data rendering. All the functionality is Ajax enabled on page load bsGrid will fire the REFRESH query on server based on the given SERVICE_URL at initialization.

   <div>
        <jsp:include page="simple" flush="true" />
   </div>

   <script type="text/javascript">
        serviceUrl = "test";
        grid_refresh();
   </script>

The above HTML/Javascript code will include the bgGrid in current page and initialize. The page attribute contains simple as a value which is nothing but the URL address for the bsGrid. As of now a Servlet does the initial rendering which in future will be replaced with pure HTML.

The serviceUrl variable has to be initialized with a proper URL, it will be used for all the grid operations.

A Servlet Wrapper is available at com.dhaval.web.report.grid.MasterServlet to parse the request and convert the data into objects.

public class EmployeeView extends MasterServlet{

   public GridDataInfo refresh(GridRequest request) {
       // return all data
   }

   public GridDataInfo search(GridRequest request) {
       List<Condition> conditions = request.getSearchCondition();
       for(Condition c : conditions){
           String val = c.getValue();
           switch(c.getPart()){
               case JOIN:
                   // AND or OR
                   break;
               case OPERATOR:
                   // ==, !=, LIKE
                   break;
               case VALUE:
                   // ABC, 120
                   break;
               case VARIABLE:
                   // Name, Age
                   break;
           }
       }
       return resultData;
   }

   public GridDataInfo page(GridRequest request) {
       int currentPage = request.getCurrentPage();
       switch(request.getNextPage()){
           case FIRST:
               break;
           case LAST:
               break;
           case NEXT:
               break;
           case PREVIOUS:
               break;
       }
       return pageData;
   }

   public GridDataInfo sort(GridRequest request) {
       String column = request.getSortColumn();
       switch(request.getSortType()){
           case ASC:
              break;
           case DESC:
              break;
       }
       return sortedData;
   }
}
Powered by Google Project Hosting