2016-06-13 77 views
0

这将更容易解释我想用图像做什么。如何以编程方式滚动下拉菜单

这是下拉菜单:(http://i.imgur.com/Y1bjEGB.png

在“composicion_estadistica”,也有崩溃的时候,你点击它是扩大领域。 问题是,当我点击它,我得到这个:(http://i.imgur.com/45zhaZl.png

扩大字段不显示,你需要向下滚动才能看到它们。我希望当这些字段展开时,它会自动向下滚动,以便您可以看到新的字段。

在这种情况下,滚动到下拉菜单的末尾将足够好,但事实并非总是如此,是否可以向下滚动到特定位置? 例如:如果扩展了10个新字段,我想向下滚动10行。

希望我解释清楚自己。

下面是代码:

<div class="dropdown" style="display:inline-block;"> 
<button class="btn btn-default btn-filtro btnWidget" type="button" data-toggle="dropdown" aria-expanded="true"> 
    Agregar Orden <span class="caret"></span> 
</button> 

<ul class="dropdown-menu" style="overflow-y:auto; max-height:300px;"> 
    <li class="dropdown" style="margin-left: 30px; cursor: pointer;" ng-repeat="field in controller.fields"> 
     {{field.name}} 
    </li> 

    <li class="divider"></li> 
    <li class="dropdown-header" style="padding: 3px 10px; font-weight: bold; cursor: default;" ng-click="$event.stopPropagation();">Relaciones</li> 

    <ng-repeat ng-repeat="relacion in controller.relaciones" ng-init="relacion.show = false"> 
     <li class="dropdown-header" style="padding: 3px 20px; font-weight: bold; cursor: default;" ng-click="relacion.show = !relacion.show; $event.stopPropagation();"> 
      <span class="" ng-class="{'caret-right': !relacion.show, 'caret-bottom': relacion.show}"></span> 
      {{relacion.name}} 
     </li> 
     <li class="dropdown" style="margin-left: 30px; cursor: pointer;" ng-repeat="field in relacion.fields" ng-show="relacion.mostrar"> 
      {{field.name}} 
     </li> 
    </ng-repeat> 

</ul> 

回答