Glow Table Row for new records entries only


#1

Hi,

I would like to have a quick glow on table rows related to recently added records since last visit, e.g:

index route - lists all entries in a table item route - have a form to add a new item and transitionTo(‘index’) when successfully created and save()'d the new record.

Any ideias how i could achieve this?

Thank you!


#2

For something like this I just add an id to the table row like this <tr id="model-name-{{model.id}}"> and then something like this:

actions: {
  createThing() {
    const model = this.store.createRecord('model-name', {});
    model.save().then(() => {
      this.transitionTo('index').then(() => {
          $(`model-name-${model.id}`).magicalHighlight();
      });
    })
  }
}

I’m sure there is a more pure ember way, but for this kind of ui fluff it’s hard to beat a little sprinkle of jquery :grin:

If someone has a better way of doing this I would very be interested in seeing it!