Rückgrat Holen Erfolgs-callback

Ich bin neu backbone.js und ich habe einige Probleme mit der Eingabe meiner Sammlung eine Erfolgs-callback. Ich bin übergeordnete Holen, um eine url mit einem parameter. Wie ich es verstehe, sollte ich in der Lage zu ordnen eine Erfolg-Rückruf in den Optionen gebe ich an das Rückgrat.Sammlung.der Prototyp.Holen.call()... aber mein code funktioniert nicht. Fetch funktioniert korrekt, aber die callback-Funktion nicht aufgerufen.

Hier ist etwas von meinem code:

App.ChartController = {
  load: function(userConceptId) {
    App.chartPointList.fetch(userConceptId);    
  }
};


App.ChartPointList = Backbone.Collection.extend({
  model: App.ChartPoint,
  url: function() {
    return '/chartpoints/' + this.userConceptId;
  },
  fetch: function(userConceptId, options) {         
    console.log("fetch chart point");               

    typeof(options) != 'undefined' || (options = {});
    options.success = this.postProcess;
    options.error = this.handleError;

    this.userConceptId = userConceptId;

    return Backbone.Collection.prototype.fetch.call(this, options);    
  },
  postProcess : function (resp, status, xhr) {
    console.log("postprocess");          //never gets called
    /**
     ... whole bunch of stuff... 
    **/
    new App.Views.ChartView({ collection: this });
  }, 
  handleError : function (resp, status, xhr) {
    alert("could not load chart data!");  //also not called
  }
});

Irgendeine Idee, was ich falsch mache? Danke!

Die - Fehler-callback funktioniert bei mir: jsfiddle.net/fguillen/vsZUD , damit sollte das problem irgendwo anders sein.

InformationsquelleAutor fdot | 2012-06-04

Schreibe einen Kommentar