sharedlabs / sortable-list

A web component for reorderable drag-and-drop lists on modern browsers and touch devices.
MIT License
36 stars 21 forks source link

[ASK] Disable position of disabled sortable item #20

Open alkunjo opened 6 years ago

alkunjo commented 6 years ago

Can we disable the position of disabled sortable item using this component? For example I have this snippet:

<sortable-list sortable=".mcItem" id="mcList" on-items-changed="itemsOrder">
  <paper-item class="mcItem" value="[[dataMcTrendCross.rows.0.id]]" disabled="true">
    <div class="col m10">[[dataMcTrendCross.rows.0.MenuCategory.name]]</div>
  </paper-item>
  <template is="dom-repeat" items="[[dataMc.rows]]" as="mc">
    <paper-item class="mcItem" value="[[mc.id]]">
      <div class="col m10">[[mc.MenuCategory.name]]</div>
      <div class="col m2">
        <paper-icon-button icon="delete" id="[[mc.id]]" on-click="deleteMc" value="[[mc.id]]"></paper-icon-button>
      </div>
    </paper-item>
  </template>
  <paper-item class="mcItem" value="[[dataMcTrendCross.rows.1.id]]" disabled="true">
    <div class="col m10">[[dataMcTrendCross.rows.1.MenuCategory.name]]</div>
  </paper-item>
</sortable-list>

On that code, I already disabled the first and the last paper-items so those can't be dragged. But somehow the other paper-items inside the dom-repeat still can be dragged and replace the disabled paper-items position. How would I disable the position of the disabled paper-items so another active paper-items can't replace their position?