Threaded View

  1. #1
    Sencha Premium Member
    Join Date
    Sep 2012
    Vote Rating
    adavis2 is on a distinguished road


    Default Paged Grid Using a directjngine Back-end

    I am trying to implement a paged grid panel using a directjngine back-end. In the long term, what I'd like to do is create a buffered (infinite) grid, where paging is handled when you scroll through the grid, but getting it working with paging is the first step.

    Currently I'm able to display a grid panel with a paging toolbar and load the first page by subsetting the data to be returned. Unfortunately, I'm not sure how to pass back the total number of records (so the paging toolbar will show "Displaying 1 - X of Y" [where Y > X] and enable the next button). Directjngine allows you to use annotations to indicate which Java methods are callable from ExtDirect, like so:
    @DirectMethod public List<Map<String, String>> getRuleTableRows(int ruleTableId, int start, int limit)
    So, with a page size of 200, this method returns a JSON response similar to this:
    { "tid": 9, "action": "DataAccessHelper", "method": "getRuleTableRows", "result": [ { "tableId": "55212", "83": "MERZ", "rowNumber": "0", "85": "Y" }, ... snipped ... { "tableId": "55212", "83": "BUIC", "rowNumber": "199", "85": "Y" } ], "type": "rpc" }
    As far as I can see, I need to have something like this:
      "tid": 9,
      "action": "DataAccessHelper",
      "method": "getRuleTableRows",
      "result": [
          "tableId": "55212",
          "83": "MERZ",
          "rowNumber": "0",
          "85": "Y"
        ... snipped ...
          "tableId": "55212",
          "83": "BUIC",
          "rowNumber": "199",
          "85": "Y"
      "total": "565",
      "type": "rpc"
    Where the "total": "565" line between the end of the result array and the "type": "rpc" field is new. But how can I configure (or extend) directjngine to pass back the total number of records in the data-set as a new JSON property outside of the result property?
    Last edited by adavis2; 25 Oct 2012 at 6:52 AM. Reason: Showed the desired output and rephrased the final question.

Thread Participants: 1

Tags for this Thread