title: Scroll to the bottom of the view of ScrollView programmatically in Nativescript
body: <p>I am developing an app where when user click on cardview layout, detail of that view is opened on that card view layout. I have used nativescript ScrollView for scrolling the views. But, when user click on last cardview layout it should scroll to show detail of cardview layout. It does not automatically scrolls to the last card view detail, due to this the detail of the card view is hidden and user have to scroll manually.</p>
  
  <p>I found this <a href="https://stackoverflow.com/questions/51181694/nativescript-scroll-to-bottom-of-scrollview-programmatically">Nativescript scroll to bottom of ScrollView programmatically</a> but i am not able to solve my problem. Below is my code for layout.</p>
  
  <pre><code>   &lt;ScrollView id="scrollView" #scrollView orientation="vertical" #scrollView     (scroll)="onScroll($event)"&gt;
  
            &lt;StackLayout row="0" col="0"&gt;
              &lt;StackLayout *ngFor="let item of items" class="card-view" id="cardViewLayout"&gt;
  
                &lt;GridLayout columns="auto, *, auto" rows="auto,auto,auto" (tap)="toggleDetail(@event)"&gt;
  
                &lt;/GridLayout&gt;
  
                &lt;GridLayout row="3" col="0" colSpan="3" columns=" *, *" rows="auto,auto" id="detailedData" visibility="hidden" class="cardDetail"&gt;
  
                  &lt;StackLayout row="0" col="0" class="detailDataStack"&gt;
                  &lt;/StackLayout&gt;
  
                &lt;/GridLayout&gt;
  
          &lt;/StackLayout&gt;
        &lt;/StackLayout&gt;
      &lt;/ScrollView&gt;
  
  
   toggleDetail(args){
      var scrollView = this.page.getViewById("scrollView")
      var offset = this.scrollView.nativeElement.scrollableHeight;
      this.scrollView.nativeElement.scrollToVerticalOffset( this.scrollView.nativeElement.offset+ 120, false);   
   }
  </code></pre>
  
  <p>As shown in above when user click on card-view class layout, it is toggling cardDetail class. When there is last item in card-view it should scroll automatically to show the details but it don't automatically scrolls.</p>
  
  <p>In toggleDetail() method i tried to get scrollableHeight, add 120 to that height and make it scroll when user in last item but nothing happened.</p>
  
  <p>Playground Sample app for this 
  <a href="https://play.nativescript.org/?template=play-ng&amp;id=Y2ZJLs&amp;v=17" rel="nofollow noreferrer">ScrollView Sample app Nativescript Playground</a></p>
  
  <p>Thank you in advance :) </p>