Git Product home page Git Product logo

ember-sortable's Introduction

ember-sortable

npm version Build Status Downloads Weekly Ember Observer Score Code Climate

Sortable UI primitives for Ember.

Check out the demo

Requirements

Ember Sortable Ember Node
3.0.0 3.24+ 12+
4.0.0 3.24+ 14+
5.0.0 3.28+ n/a1

Installation

$ ember install ember-sortable

Usage

{{! app/components/my-list/template.hbs }}

<ol {{sortable-group onChange=this.reorderItems}}>
  {{#each this.items as |item|}}
    <li {{sortable-item model=item}}>
      {{item}}
      <span class='handle' {{sortable-handle}}>&varr;</span>
    </li>
  {{/each}}
</ol>

<p>The last dragged item was: {{this.lastDragged}}</p>

The onChange action is called with two arguments:

  • Your item models in their new order
  • The model you just dragged
// app/components/my-list/component.js

export default class MyList extends Component {
  @tracked lastDragged;
  @tracked items = ['Coal Ila', 'Askaig', 'Bowmore'];

  @action
  reorderItems(itemModels, draggedModel) {
    this.items = itemModels;
    this.lastDragged = draggedModel;
  }
}

The modifier version does not support groupModel, use the currying of action or the fn helper.

{{! app/components/my-list/template.hbs }}

<ol {{sortable-group onChange=(fn this.reorderItems model)}}>
  {{#each this.items as |item|}}
    <li {{sortable-item model=item}}>
      {{item}}
      <span class='handle' {{sortable-handle}}>&varr;</span>
    </li>
  {{/each}}
</ol>

Changing sort direction

To change sort direction, define direction on sortable-group Possible values are:

  • y (default): allowes to move items up/down
  • x: allowes to move items left/right
  • grid: items can be moved in all directions inside a group
<ol {{sortable-group direction="x" onChange=this.reorderItems}}>

Changing spacing between currently dragged element and the rest of the group

When user starts to drag element, other elements jump back. Works for all direction option.

In y case: elements above current one jump up, and elements below current one - jump down. In x / grid case: elements before current one jump to the left, and elements after current one - jump to the right.

To change this property, define spacing on sortable-item (default is 0):

<li {{sortable-item spacing=15}}>

Changing the drag tolerance

distance attribute changes the tolerance, in pixels, for when sorting should start. If specified, sorting will not start until after mouse is dragged beyond distance. Can be used to allow for clicks on elements within a handle.

<li {{sortable-item distance=30}}>

Disabling reordering

The disabled attribute allows you to disable sorting for the entire group and its child items.

<li {{sortable-group disabled=true}}>

CSS, Animation

Sortable items can be in one of four states: default, dragging, dropping, and activated. The classes look like this:

<!-- Default -->
<li class="sortable-item">...</li>
<!-- Dragging -->
<li class="sortable-item is-dragging">...</li>
<!-- Dropping -->
<li class="sortable-item is-dropping">...</li>
<!-- Keyboard -->
<li class="sortable-item is-activated">...</li>

In our example app.css we apply a transition of .125s in the default case:

.sortable-item {
  transition: all 0.125s;
}

While an item is dragging we want it to move pixel-for-pixel with the user’s mouse so we bring the transition duration to 0. We also give it a highlight color and bring it to the top of the stack:

.sortable-item.is-dragging {
  transition-duration: 0s;
  background: red;
  z-index: 10;
}

While dropping, the is-dragging class is removed and the item returns to its default transition duration. If we wanted to apply a different duration we could do so with the is-dropping class. In our example we opt to simply maintain the z-index and apply a slightly different colour:

.sortable-item.is-dropping {
  background: #f66;
  z-index: 10;
}

If the user presses space to activate and move an item via the keyboard, is-activated is added. Once the user drops the item it is removed. Use this class to add a visual indicator that the item is selected and being manipulated.

Drag Actions

The onDragStart and onDragStop actions are available for the sortable-items. You can provide an action to listen to these actions to be notified when an item is being dragged or not.

When the action is called, the item's model will be provided as the only argument.

// app/components/my-list/component.js

export default class MyRoute extends Route {
  @action
  dragStarted(item) {
    console.log(`Item started dragging: ${item}`);
  },
  @action
  dragStopped(item) {
    console.log(`Item stopped dragging: ${item}`);
  }
}
<li {{sortable-item onDragStart=this.dragStarted onDragStop=this.dragStopped model=item}}>
  {{item}}
  <span class='handle' {{sortable-handle}}>&varr;</span>
</li>

Multiple Ember-Sortables renders simultaneously

There is a service behind the scenes for communication between the group and the items and to maintain state. It does this seemlessly when the elements are rendered on the screen. However, if there are two sortables rendered at the same time, either in the same component or different components, the state management does not know which items belong to which group.

Both the {{sortable-group}} and {{sortable-item}} take an additional argument groupName. Should you encounter this conflict, assign a groupName to the group and items. You only need to do this for one of the sortables in conflict, but you can on both if you wish.

<ol {{sortable-group groupName='products' onChange=this.reorderItems}}>
  {{#each this.items as |item|}}
    <li {{sortable-item groupName='products' model=item}}>
      {{item}}
      <span class='handle' {{sortable-handle}}>&varr;</span>
    </li>
  {{/each}}
</ol>

Ensure that the same name is passed to both the group and the items, this would be best accomplished by creating property on the component and referring to that property. If you are able to use the {{#let}} helper (useful in template only components), using {{#let}} makes the usage clearer.

{{#let 'products' as |myGroupName|}}
  <ol {{sortable-group groupName=myGroupName onChange=this.reorderItems}}>
    {{#each this.items as |item|}}
      <li {{sortable-item groupName=myGroupName model=item}}>
        {{item}}
        <span class='handle' {{sortable-handle}}>&varr;</span>
      </li>
    {{/each}}
  </ol>
{{/let}}

Disabling Drag (Experimental)

sortable-item exposes an optional disabled (previously isDraggingDisabled) flag that you can use to disable reordering for that particular item. Disabling and item won't prevent it from changing position in the array. The user can still move other non-disabled items to over it.

This flag is intended as an utility to make your life easier with 3 main benefits:

  1. You can now specify which sortable-item are not intended to be draggable/sortable.
  2. You do not have to duplicate the sortable-item UI just for the purpose of disabling the sorting behavior.
  3. Allows you to access the entire list of models for your onChange action, which can now be a mix of sortable and non-sortable items.

Data down, actions up

No data is mutated by sortable-group or sortable-item. In the spirit of “data down, actions up”, a fresh array containing the models from each item in their new order is sent via the group’s onChange action.

Each item takes a model property. This should be fairly self-explanatory but it’s important to note that it doesn’t do anything with this object besides keeping a reference for later use in onChange.

Accessibility

The sortable-group has support for the following accessibility functionality:

Built-in Functionalities

Keyboard Navigation

There are 4 modes during keyboard navigation:

  • ACTIVATE enables the keyboard navigation. Activate via ENTER/SPACE
  • MOVE enables item(s) to be moved up, down, left, or right based on direction. Activate via ARROW UP/DOWN/LEFT/RIGHT
  • CONFIRM submits the new sort order, invokes the onChange action. Activate via ENTER/SPACE.
  • CANCEL cancels the new sort order, reverts back to the old sort order. Activate via ESCAPE or when focus is lost.
Focus Management
  • When focus is on a item or handle, user can effectively select the item via ENTER/SPACE. This is the ACTIVATE mode.
  • While ACTIVATE, the focus is locked on sortable-group container and will not be lost until CONFIRM, CANCEL, or focus is lost.

User configurable

Screen Reader

The default language for ember-sortable is English. Any language can be supported by passing in the configuration below in the appropriate language.

  • a11yItemName a name for the item. Defaults to item.
  • a11yAnnouncementConfig a map of action enums to functions that takes the following config, which is exposed by sortable-group.
a11yAnnounceConfig = {
  a11yItemName, // name associated with the name
  index, // 0-based
  maxLength, // length of the items
  direction, // x or y
  delta, // +1 means down or right, -1 means up or left
};

and returns a string constructed from the config.

Default value

{
  ACTIVATE: function({ a11yItemName, index, maxLength, direction }) {
    let message = `${a11yItemName} at position, ${index + 1} of ${maxLength}, is activated to be repositioned.`;
    if (direction === 'y') {
      message += 'Press up and down keys to change position,';
    } else {
      message += 'Press left and right keys to change position,';
    }

    message += ' Space to confirm new position, Escape to cancel.';

    return message;
  },
  MOVE: function({ a11yItemName, index, maxLength, delta }) {
    return `${a11yItemName} is moved to position, ${index + 1 + delta} of ${maxLength}. Press Space to confirm new position, Escape to cancel.`;
  },
  CONFIRM: function({ a11yItemName}) {
    return `${a11yItemName} is successfully repositioned.`;
  },
  CANCEL: function({ a11yItemName }) {
    return `Cancelling ${a11yItemName} repositioning`;
  }
}
Visual Indicator
  • handleVisualClass This class will be added to the sortable-handle during ACTIVATE and MOVE operations. This allows you to add custom styles such as visual arrows via pseudo classes.

  • itemVisualClass This class will be added to the sortable-item during ACTIVATE and MOVE operations. The default class added is is-activated. This is needed to creating a visual indicator that mimics focus b/c the native focus is on the container.

Testing

ember-sortable exposes some acceptance test helpers:

  • drag: Drags elements by an offset specified in pixels.
  • reorder: Reorders elements to the specified state.
  • keyboard: Keycode constants for quick.

To include them in your application, you can import them:

import { 
  drag, reorder,
  ENTER_KEY_CODE,
  SPACE_KEY_CODE,
  ESCAPE_KEY_CODE,
  ARROW_KEY_CODES,
} from 'ember-sortable/test-support';

Examples

Reorder

await reorder('mouse', '[data-test-vertical-demo-handle]', ...order);

Drag

await drag('mouse', '[data-test-scrollable-demo-handle] .handle', () => {
  return { dy: itemHeight() * 2 + 1, dx: undefined };
});

Keyboard

await triggerKeyEvent('[data-test-vertical-demo-handle]', 'keydown', ENTER_KEY_CODE);

Migrating

v3 -> v4

None, just make sure Node v14+ and Ember is v3.24+. Although older versions might work, but are no longer tested against. Specifically ember-modifier dropped support for older versions of Ember.

v2 -> v3

The component versions have been removed and you must use the modifier. The modifier version does not support groupModel, use the currying of the fn helper.

v1 -> v2

If you are migrating from 1.x.x to 2.x.x, For components, please read this migration guide. For modifiers, please read this migration guide.

Developing

Requirement

You need to install nodejs and pnpm. The specific versions you need, you can find here

Setup

$ git clone [email protected]:adopted-ember-addons/ember-sortable
$ cd ember-sortable
$ pnpm install

Dev Server

$ cd test-app
$ ember serve

Running Tests

$ pnpm run test

Publishing Demo

$ make demo

Footnotes

  1. Node is not relevant for v2 addons. As of v5.0.0, ember-sortable is a v2 addon. V2 addons don't have to be for browser-only contexts, but ember-sortable is -- so node is not relevant anymore. This is different from v1 addons, which are not browser libraries, but node programs that happen emit browser code to the consuming app at app-build time.

ember-sortable's People

Contributors

acburdine avatar alexlafroscia avatar bnitobzh avatar cah-brian-gantzler avatar charlesfries avatar chriskrycho avatar dependabot[bot] avatar dhaulagiri avatar eugeniodepalo avatar faith-or avatar fivetanley avatar jacojoubert avatar jgwhite avatar jmar910 avatar kiwiupover avatar knownasilya avatar leoeuclids avatar mixonic avatar mkszepp avatar mrloop avatar nbibler avatar nicolechung avatar nlfurniss avatar nullvoxpopuli avatar renovate[bot] avatar rlivsey avatar snewcomer avatar st-h avatar tim-evans avatar ygongdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-sortable's Issues

Augmenting `transform`

(Great lib!)

Is there a way to augment the transform property on the dragging element?

I was hoping to achieve this effect by using transform: scale on the dragging element, but the transforms added by this lib override it. As far as I know there's no way to stack transforms in CSS.

If not, perhaps I could think through an API and PR it. Or maybe the library could check if there's a transform property, and just replace the translateY piece of it. Thoughts?

Table rows move incorrectly when sorting

When a sortable-group contains <tr> elements as its sortable-items, dragging an item to sort results in the rest of the table rows being pushed much further down the height of the table than is expected. The magnitude of the effect seems to derive from the position of the table on the page -- in a real page, where the table was further down, the rows were pushed so far out that they were not visible.

Nested .handle doesn't work as expected

Hi, I'm having some issues with getting .handle to work given the following layout (emblem):

.row.col-md-9
  = sortable-group tagName="div" onChange='reorderItems' as |group|
    = each sortedModel as |item|
      = sortable-item tagName="div" model=item group=group handle='.handle'
        .col-md-12: .block.block-bordered.block-link-hover3
          table.block-table: tbody: tr
            td.bg-gray-lighter.border-r style='width: 100px;'
              img.pull-left src='https://placeholdit.imgix.net/~text?txt=100%C3%97100&w=100&h=100'
            td
              .h5.push-5-t
                span.text-muted.text-uppercase Caption: &nbsp;
                = item.caption
              .h5.push-5-t
                span.text-muted.text-uppercase First Comment: &nbsp;
                = item.first_comment
            td.bg-gray-lighter.border-l style='width: 20px;'
              span.handle data-item=item &vArr;

What's happening is that I can drag the items, but they don't move out of the way for each other or reorder, e.g. if I have two elements and i drag the bottom one up, the top one doesn't move at all.

I did some experimentation and have found that a lot of the time a <span class="handle"> is not recognised unless it's a top element inside the {{#sortable-item}}. Is there a way around this? 😄

Actions in components contained in sortable-item do not always work

I'm having intermittent problems with actions when I'm using a sortable list. I have a list of items, each rendered with a component. That component has a "delete" action on it, activated by clicking the 'x' next to the item name.

The following code should give an idea what I'm talking about.

{{!-- templates/items.hbs --}}
{{#sortable-group onChange="itemsReordered" as |group|}}
  {{#each model.items as |item|}}
    {{#sortable-item model=item group=group handle=".item-list-item"}}
      {{item-list-item item=item deleteItem="deleteItem"}}
    {{/sortable-item}}
  {{/each}}
{{/sortable-group}}

The item-list-item component has the following template:

{{!-- templates/components/item-list-item.hbs --}}
{{item.name}}<span {{action "deleteItem"}}>x</span>

and the accompanying script file

// components/item-list-item.js
import Ember from 'ember';

export default Ember.Component.extend({
    classNames: ["item-list-item"],
    item: null,

    actions: {
        deleteItem: function () {
            this.sendAction("deleteItem", this.getAttr("item"));
        }
    }
});

Until today, I've found that this has worked flawlessly (or possibly almost flawlessly, and I just assumed that I'd missed the 'x' when it didn't work), as have my two colleagues who have been using the code. As of today, both myself and my colleague are finding that more often than not (> 90% of the time), the deleteItem action doesn't get called. Looking at the DOM inspector, we can see that when this is the case, the .item-list-item div gets the is-dragging class, whilst when deleteItem gets called, it does not. My guess is that there is a race condition between which handler gets called first, and the second handler does not get called.

For now, I can work around this by making the draggable part not include the 'x', but I'd like to avoid doing this if possible.

Disable on right click

Right click currently starts drag. I'm constantly hitting it when I try to inspect element in Chrome.

Replace `model.items` example with just `model`

It seems to me that the only reason why model.item is used in the examples, is because this.set('currentModel', anArray); doesn't trigger a property change. But since Ember has a special syntax for dealing with arrays, I'd consider updating the examples to the following, if you feel it's not that confusing:

actions: {
  reorderItems(newOrder) {
    this.set('currentModel.[]', newOrder);
  }
}

I can submit the PR if you're in favor.

Glimmer compatibility

Previously we could count on Ember simply replacing all elements when the collection changes. Glimmer’s element re-use demands a new approach.

Concerns:

  • Strip transforms
  • Clear cached _y
  • Somehow avoid weird transitions

remove this line from the readme

You're doing the right thing™. Don't ask people to tell you otherwise ;)

While it would be technically possible to automatically discover the parent group, we feel establishing this relationship explicitly is clearer. Feedback welcome.

itemModels, draggedModel got null HELP!!!

{{#sortable-group tagName="ul"  onChange="modelsOnChange" as |group|}}
  {{#each model.models as |brandModel|}}
    {{#sortable-item tagName="li" model=brandMmodel group=group handle=".handle"}}
      {{brandModel.GuiGeXingHao}}
      {{#md-button class="md-raised md-primary" param=brandModel}}详情
      {{/md-button}}
      {{#md-button class="md-raised md-primary" action="delModel"}}删除
      {{/md-button}}
      <span class="handle">&varr;</span>
    {{/sortable-item}}
  {{/each}}
{{/sortable-group}}
export default Em.Route.extend({
  instanceInit:function(){
    console.log("Route changemodelsorder instanceInit end");
  }.observes().on('init'),
  model: function(params){
    var brandName = params['brandName'];
    return Em.RSVP.hash({
      models:this.haida.getShowModels(brandName).then(function(models){
        console.log(models);
        return models;
      }),
    });
  },
  actions:{
    modelsOnChange:function(itemModels, draggedModel) {
      //console.log(groupModel);
      console.log(itemModels);
      console.log(draggedModel);
      var models = this.get('currentModel.models');
      console.log(models);
      //groupModel.setObjects(itemModels);
    }
  }
});

itemModels, draggedModel got null,
And I can NOT get an new Order.
Please HELP ⏰

Unable to select text

Whenever you try an select text it starts the dragging rather than selects the text

Hooks should call _super

Just ran into an issue where my own code didn't call _super on didInsertElement which stopped ember-sortable working, but the opposite could also happen (depending on mixin inclusion order).

didInsertElement etc should call this._super() once they've done their thing so we can pass the baton along.

Group model?

{{! app/templates/foo.hbs}}

{{#sortable-group model=model onChange="reorder" as |group|}}
  {{#each model.items as |item|}}
    {{#sortable-item model=item}}
      {{item}}
    {{/sortable-item}}
  {{/each}}
{{/sortable-item}}
// app/routes/foo.js

export default Ember.Route.extend({
  actions: {
    reorder(model, newOrder) {
      model.set('items', newOrder);
    }
  }
});

Allow form fields within sortable

I have a sortable with form fields. If I don't specify a handle, the component doesn't allow me to focus into any of the form fields.

SortableItemMixin

From @rlivsey:

I wonder if there should be a SortableItemMixin which SortableItemComponent uses, that way you can make a component sortable by mixing in the mixin from the addon without using the compoment.

Limit drag area

Thank you for the awesome addon!

It should be possible to prevent draggable items to be moved outside the specified area (typically the sortable-group).

Saving Order

What is the recommended approach for saving order to groupModel in ember data? How can we persist order to groupModel such that the order can be retrieved and displayed in the view as it was arranged?

My current implementation:

deck.hbs:

{{#sortable-group tagName="ul" model=model class="deck-slides-nav-slides" onChange="reorderItems" as |group|}}
            {{#each model.slides as |slide|}}
                {{#sortable-item tagName="li" model=slide group=group handle=".handle" class="deck-slides-nav-slides-slide"}}
                    <span class="handle">&varr;</span>
                    {{#link-to "admin.decks.deck.slides.slide" slide class="deck-slides-nav-slides-slide-link"}}
                        {{#slide-instance slide=slide deck=model onRemove="removeSlide"}}{{/slide-instance}}
                    {{/link-to}}
                {{/sortable-item}}
            {{/each}}
{{/sortable-group}}

routes/deck.js:

export default Ember.Route.extend({
    model(params) {
        return this.store.findRecord("deck", params.deck_id);
    },
    actions: {
        reorderItems(groupModel, itemModels, draggedModel) {
            debugger;
            groupModel.set("slides", itemModels);
            return Ember.RSVP.all([draggedModel.save(), groupModel.save()]);
        }
    }
});

In this case, I am suspecting that order is saved from within the structure of the payload json request sent with save(), but in cases where the server returns items in its own sorted order, what is the recommended approach to persisting order?

Can't sort items of different sizes

The maths for the positioning currently assumes that the items all have the same dimensions. I haven't dug into the positioning code yet but I suspect this is going to be tricky...

Uncaught TypeError: Cannot read property 'css' of undefined

Hey guys,

I just implemented ember sortable successfully but when I go about and drag an item ontop of the next item and drop it I get this in my console: Uncaught TypeError: Cannot read property 'css' of undefined

And then it immediately takes me to my homepage of my app..

Is this a bug? Or am I implementing it wrong?

Thanks,

Ethan

emit mouseDown event

In a long-ish list, when re-ordering, I want to zoom out the UI (apply a CSS transform to shrink all the elements).
This will allow the user to easily drag and drop elements a large number of elements away.
I think I could do this if we had a mouseDown event and i could do custom stuff from it.

What do you think? I think it would mean exposing another handle like onChange.

onChange fires onClick

it looks like when i click an element, it also fires the onChange action. i'm guessing this also reinserts the element? i'm yielding a component templet inside the sortable items and they lose their state onChange. So they're also losing their state

visible drop-target

It would be nice to have a visible drop-target rather than just open up a space. Depending on what's in your list, the space alone can be unclear at times. I'm thinking that we add an additional class "drop-target" onto the item before the space and style it with something like:

.sortable-item.drop-target:after
{
content: " ";
display: block;
width : 100%;
height : 50px;
border : 2px dashed yellow;
background-color: #FFF8F8;
opacity: 1;
}

In the case where the drop target is before the first item, we can add a different class "drop-target-before" and use :before CSS selector instead.

I've looked through the code and now have a reasonably good idea how most of it works. But some of it is still eluding me...

I can see how the dragged item updates its position. And that it calls update on the group which in turn sets their positions. What I can't see is how the other item's position is calculated? Could you provide a few notes on how that works please?

Supported Nested groups

Hi!
In my use case I have a sortable set nested inside another array of objects. Something like:

model() {
  return {
    groups: [
      { 
        id: 0,
        items: [
          { name: 'Uno' },
          { name: 'Dos' },
          { name: 'Tres' },
          { name: 'Cuatro' },
          { name: 'Cinco' }
        ]
      },{ 
        id: 1,
        items: [
          { name: 'Eins' },
          { name: 'Zwei' },
          { name: 'Drei' },
          { name: 'Vier' },
          { name: 'Fünf' }
        ]
      }
    ]
  };
}

In the current code, I cannot specify which group the reorderItems action handler should target, since only the newOrder array is given.

Could we modify the sortable-group component to accept an additional source variable, so that the reorderItems know which group it is suppose to modify?

I've created a branch here.

Mobile sorting is not working

Sorting worked fine on mobile browsers in the past but the latest version appears to have broken the mobile/touch events. It works fine on desktop but no activities at all on mobile.

Passing actions up from the items

Each of my sortable items is a component and has actions I need to bubble up to the top-level controller (ie the controller for the template rendering the sortable group)

Is there a way to do this?

Manually refresh model, and other options

Hey there. First of all, what a nice addon! I like the look and feel of the animated objects when sorting...

But i'm currently facing some issues while trying to save the elements position in the server... I need to send only the data from the item that had it's position changed, and i can't replace the model with a new Array, cause i have some dynamic itens that can be added and removed, and i would lost the bind doing this.

So... I would like to know if is there some option to turn off the auto-refresh model, so then i can refresh it only after the servers response. Is that possible?

(sorry, i cant post any code snippet doe to the company's contract)

Other thing that would be nice, is to add a "newPosition" argument in the actions "onDragStop" and "onChange"... Because, in my case, i need to set the new position index in a property "position" and PATCH it to the server... I managed to make it by doing a forEach in the groupModel, look for the item.id and get the index of the match, but would be very helpfull to have some argument with this value...

Thank you very much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.