javascript – Ddrag和drop and bootstrap UI Accordion

我有这样的代码:

<div ui-tree>
    <ol ui-tree-nodes="" ng-model="policies">
      <li ng-repeat="item in policies" ui-tree-node>
        <div ui-tree-handle>
          <accordion>
            <accordion-group>
              <accordion-heading>
              {{item.Title}}
              <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': status.open, 'glyphicon-chevron-right': !status.open}"></i></accordion-heading>
              {{item.Content}}                      
            <ol ui-tree-nodes="" ng-model="item.Options" data-nodrop>
              <li ng-repeat="subItem in item.Options" ui-tree-node>
                <div ui-tree-handle>
                    <accordion-group>
                      <accordion-heading>{{subItem.Title}}<i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': status.open, 'glyphicon-chevron-right': !status.open}"></i></accordion-heading>
                      {{subItem.Content}}
                  </accordion-group>
                </div>
              </li>
            </ol>
            </accordion-group>
          </accordion>
        </div>
      </li>
    </ol>
  </div>

当我点击标题滚动手风琴引导程序的内容时,我得到拖放事件处理

我怎么能:

添加到accordion-header一些图标,借助我可以拖放我的所有节点,当我点击标题我的数据作为引导程序滚动?它是否真的发生了事件?如何?

https://github.com/JimLiu/angular-ui-tree

http://angular-ui.github.io/bootstrap/

UPD:

<script id="template/accordion/accordion-group.html" type="text/ng-template">
  <div class="panel panel-default">            
    <div class="panel-heading">
      <h4 href class="btn btn-success btn-xs accordion-toggle pull-left" data-nodrag ng-click="toggleOpen();"><i class="glyphicon" ng-class="{'glyphicon-chevron-right': isOpen, 'glyphicon-chevron-down': !isOpen}"></i></h4>
      <h4 class="panel-title">
        <a href accordion-transclude="heading"><span>{{heading}}</span></a>
      </h4>
    </div>
    <div class="panel-collapse" collapse="!isOpen">
      <div class="panel-body" ng-transclude></div>
    </div>
  </div>
</script>
  <div ui-tree="options" data-drag-delay="20">
    <ol ui-tree-nodes="" ng-model="articles">
      <li ng-repeat="item in articles" ui-tree-node>
        <div ui-tree-handle>
          <accordion close-others="false">
            <accordion-group>
              <accordion-heading>
              {{item.Title}}
              </accordion-heading>                      
              <div ng-bind-html="item.Content"></div>                     
            <ol ui-tree-nodes="" ng-model="item.Options">
              <li ng-repeat="subItem in item.Options " ui-tree-node>
                <div ui-tree-handle>
                  <accordion close-others="false">
                    <accordion-group>
                      <accordion-heading>{{subItem.Title}}
                      </accordion-heading>
                      <div ng-bind-html="subItem.Content"></div>
                    </accordion-group>
                  </accordion>
                </div>
              </li>
            </ol> 
            </accordion-group>                   
          </accordion>
        </div>
      </li>
    </ol>
  </div>

只有当我单击标题文本或正文文本时才会拖放工作(当在面板标题上没有触发时)
打开是在ng-click =“toggleOpen();”一切都好,只是拖放必须在整个元素上(光标是整个元素,但拖放仅适用于元素文本)

怎么可能与范围?

最佳答案 Wrap< accordion-heading> < div>中的内容

HTML手风琴代码

      <accordion close-others="false">
        <accordion-group is-open="isopen">
          <accordion-heading ng-click="isopen=!isopen">
          <div>{{item.Title}}</div>
          </accordion-heading>                      
          <div ng-bind-html="item.Content"></div>                     
        <ol ui-tree-nodes="" ng-model="item.Options">
          <li ng-repeat="subItem in item.Options " ui-tree-node>
            <div ui-tree-handle>
              <accordion close-others="false">
                <accordion-group>
                  <accordion-heading>{{subItem.Title}}
                  </accordion-heading>
                  <div ng-bind-html="subItem.Content"></div>
                </accordion-group>
              </accordion>
            </div>
          </li>
        </ol> 
        </accordion-group>                   
      </accordion>

希望这会帮助你.

点赞