lundi 2 mai 2016

strange behavior ember infinity addon

I try to implement ember-infinity add-on in my app,

So I updated my Api to return the same meta uses by the add-on, but the behavior is strange.

I expect the first n records display on my div, and when I go to the bottom it fires the next request with others 20 records.

But it doesn't happen,

When I request my index page, the add-on start to fire x requests depending of the total_pages number, and this is the strange parts, I don't understand why fire all the request automatically, maybe is the ember version?.

fires x during the load

To clarify my issue, here is my code.

Meta API

"meta": {
        "page": 3,
        "per_page": 20,
        "total_pages": 3,
        "total_records": 58
    }

ember route

// route/index.js
import Ember from 'ember';
import InfinityRoute from "ember-infinity/mixins/route";

export default Ember.Route.extend(InfinityRoute, {
    model() {
        return this.infinityModel('trademark', {perPage: 20, startingPage: 1});
    }
});

template index

<div class="row" id='list-trademarks'>

    <div class="col s12 m6 l4">
      <div class="card small" style='padding-top: 0 !important; margin-top: 0 !mportant'>

           

        <div class="card-reveal">
          <span class="card-title grey-text text-darken-4"> similares.<i class="material-icons right">close</i></span>
          
        </div>
      </div>
    </div>


</div>

Ember info

DEBUG: Ember           : 2.4.5
DEBUG: Ember Data      : 2.5.2 
DEBUG: jQuery          : 2.2.3

I'm following the README but I can't get it works.




Aucun commentaire:

Enregistrer un commentaire