Announcement

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

    Problems with scrollTo

    Greetings,

    I can't figure out how to delete this post. I've discovered some issues with my code that I need to straighten out before posting something that makes sense. I noticed in my post that my code had errors.

    S
    Last edited by svonmiller; 22 Oct 2010, 06:57.

    #2
    scrollTo is working now. However, I'm using setTimeout to call the function that scrolls the user to the record they just added (and has been selected server side). Seems like setTimeout is the only way to do it, but I don't really like doing it that way. Is there another method?

    Comment


      #3
      Try DeferredCommand.

      Comment


        #4
        Unfortunately I'm not using GWT, I'm using the regular SmartClient. I think this method only exists as part of the GWT framework.

        Comment


          #5
          Hi Svonmiller,
          If you're just looking for a way to issue a command on a delay, you can use setTimeout, or Page.setEvent("idle", ...) or <someWidget>.delayCall(<methodName>, <arguments>)

          However it's not clear from your post exactly what you're looking for - I'm guessing setTimeout seems wrong because you'd prefer to be responding to an event (for example when data loads, scroll into view) - rather than assuming that the load will occur before an arbitrary timeout fires...

          If you can lay out your exact use case we'll let you know what we recommend

          Comment


            #6
            Hi Isomorphic_Paul,

            How can we link the scrolling to such events?

            My use case:
            The calendar widget doesn't scroll the current view to the workday. For example: if I configure the calendar to open with the week view, the day view scrolls to the weekday but the week view doesn't. Afterward the calendar is completely initialized, I can (triggered by a button) scroll also the week view to the workday.

            I guess this is some kind of timing issue. How could I trigger the scroll to workday after the calendar widget is completely initialized?

            Please find attached a test cases demonstrating the behavior.

            Thanks a lot!

            rroeller
            Attached Files

            Comment


              #7
              @Isomorphic_Paul - Greetings, yes I want to do exactly what you mentioned, after data loads, scroll into view. Settimeout is definitely the wrong way to do it, but I'm not sure how else to achieve it. Should I use a callback function? I think I tried that but it didn't work. In other words, the callback fired before the grid finished drawing with new data. Maybe I'll try it again to be sure.

              I've got a similar issue with a TreeGrid where the user moves to another page (different URL) and that page has the same TreeGrid on it. So I getViewState() on first page then when the second page loads I TreeGrid.setViewState(). But it won't work unless the treegrid is finished completely drawing. And I don't know how to figure how when that occurs, so i've been just using setTimeOut. Again, terrible way to do it, so I'm looking for suggestions on how this is usually done.

              Thanks!
              S

              Comment


                #8
                In both cases, if you call fetchData(), there is a callback method you can use that fires when the fetch is complete. Also, the dataArrived event fires whenever data is loaded (first time, or later).

                Comment


                  #9
                  Thanks, I'll try that. I guess this approach would also work for treeGrid.setViewState(), correct?

                  Comment


                    #10
                    This works perfectly, for both the grids and trees. Thanks!

                    Comment


                      #11
                      Thank you, Isomorphic!

                      Comment

                      Working...
                      X