Examples of JQGridPostData


Examples of org.molgenis.framework.tupletable.view.JQGridJSObjects.JQGridPostData

          break;
        case RENDER_DATA:
          final List<QueryRule> rules = new ArrayList<QueryRule>();

          // parse the request into post data
          final JQGridPostData postData = new JQGridPostData(request);

          // convert any filters to query rules
          final List<QueryRule> filterRules = createQueryRulesFromJQGridRequest(postData.getFilters());

          if (CollectionUtils.isNotEmpty(filterRules))
          {
            rules.addAll(filterRules);
          }

          int residue = 0;
          final int rowCount = tupleTable.getCount();
          if (rowCount % postData.getRows() != 0)
          {
            residue = 1;
          }
          final int totalPages = (int) Math.floor(rowCount / (double) postData.getRows()) + residue;

          // update page
          postData.setPage(Math.min(postData.getPage(), totalPages));
          final int offset = Math.max((postData.getPage() - 1) * postData.getRows(), 0);

          final String exportSelection = request.getString("exportSelection");
          if (!StringUtils.equalsIgnoreCase(exportSelection, "ALL"))
          {
            // data.rows == limit
            tupleTable.setLimit(postData.getRows());
            // data.rows * data.page
            tupleTable.setOffset(offset);
          }

          if (StringUtils.isNotEmpty(postData.getSidx()))
          {
            final Operator sortOperator = StringUtils.equals(postData.getSord(), "asc") ? QueryRule.Operator.SORTASC
                : QueryRule.Operator.SORTDESC;
            rules.add(new QueryRule(sortOperator, postData.getSidx()));
          }

          if ((tupleTable instanceof FilterableTupleTable) && !request.isNull("_search")
              && request.getBoolean("_search"))
          {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.