Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How can a Live Grid fetch data without changing the start row

    Dear all,

    I would like to add/or remove some rows within a life list grid. Instead of removing this elements on client side, I would like to manipulate the list on server side. Then the list grid should behave similar to scrolling (fetching the data with appropriate request.startRow and request.endRow) but without scrolling (sticking the first element).

    Is this possible?

    Thanks and Regards

    Uwe

    #2
    Can you try again to describe the behavior you're looking for, only with a lot more detail?

    Comment


      #3
      Dear Isomorphic,

      thank you for reply.
      I would like to simulate a TreeGrid with a Life List Grid (because TreeGreed does not support life scrolling).
      Let's say the user scrolled down some elements and is now seeing following content in the Grid:
      The start row should be 11, the visible number of rows is 5:

      ----------------------
      11
      12
      13
      14
      15
      ----------------------

      The user should be able to click e.g. 12 and the screen should be changed as following:

      ----------------------
      11
      12
      -12-1
      -12-2
      -12-3
      ----------------------

      I would like to calculate the result rows on server side newly. Because this can be some thousand rows. So the life fetching feature would be a good solution.

      I tried following:
      When the user clicks 12, the search criteria are changed and a refresh of the list should be enforced, e.g. by this:

      listGrid.invalidateCache();
      listGrid.fetchData(criteria);

      When running the code, an executeFetch was triggerd with request.startRow = 0. The content of the list has changed to
      the initial situation:

      ----------------------
      1
      2
      3
      4
      5
      ----------------------

      But I would like that the first element should be 11.

      I tried following code:

      listGrid.invalidateCache();
      Integer v[] = listGrid.getVisibleRows();
      DSRequest dsr = new DSRequest();
      dsr.setStartRow(v[0]);
      dsr.setEndRow(v[1]);
      listGrid.fetchData(criteria, null, dsr);

      But this did not work too.

      Is it possible to refresh the list by fetching the data newly and enforcing that the start position should remain.

      Thank you very much.

      Best Regards

      Uwe

      Comment


        #4
        The best way to do this is to manage your dataset directly and call setData() when it changes. Notice, when you open one of your tree nodes, you are not "invalidating the cache" but just changing the data. setData() is appropriate for this; invalidateCache() is telling the grid that a totally unrelated dataset is being loaded and hence it should scroll to the top.

        Comment


          #5
          Dear Isomorphic,

          thanks for your reply and your suggestion (setData).

          Originally posted by Isomorphic
          invalidateCache() is telling the grid that a totally unrelated dataset is being loaded and hence it should scroll to the top
          So I see that it is not possible, to clear the cache but keep the current position. Could you confirm this?

          I would like to avoid the suggested "setData"-way . My "dream" was to have "one" simple fetching method that get filter criteria (also including the ids of the already expanded nodes) and generates a result set for page intervals (startRow, endRow) on demand close to the database.

          If then a node would be expanded that contains many children (e.g. some thousands rows), the number of data that will be loaded to the client would be much less (e.g. max. 100, depending on paging interval).

          The user is open to scroll (-> load the next children) or to refine the filter criteria to get less results.

          So I think, I will change the design to the standard way: using a TreeGrid.
          To avoid the loading of mass children, I will limit the number of children to e.g. 200 and add a hint to the label of the parent node indicating the real numbers of nodes, e.g. "Parent 12 (200/3458)". So the user have to refine the filter criteria, if the desired data is not part of the 200 child rows.

          (By the way, I have noticed, that the IE7 has to work very hardly, if the DOM is increasing too much. The memory as well as the reaction time are affected. Firefox seems to be able to handle this in a much better way.)
          Last edited by renzland; 3 Jul 2009, 12:26.

          Comment

          Working...
          X