shared/base/view.js
function() {
    var params = {},
        fetchOptions,
        fetchSpec;

    if (this.options.fetch_params) {
      if (!_.isObject(this.options.fetch_params)) {
        throw new Error('fetch_params must be an object for lazy loaded views');
      }

      params = this.options.fetch_params;
    } else if (this.options.param_name) {
      params[this.options.param_name] = this.options.param_value;
    }

    if (this.options.fetch_options) {
      if (!_.isObject(this.options.fetch_options)) {
        throw new Error('fetch_options must be an object for lazy loaded views');
      }

      fetchOptions = this.options.fetch_options;
    }

    if (this.options.model_id != null) {
      params.id = this.options.model_id;
    }

    if (this.options.model_name != null) {
      fetchSpec = {
        model: {
          model: this.options.model_name,
          params: params
        }
      };
    } else if (this.options.collection_name != null) {
      fetchSpec = {
        collection: {
          collection: this.options.collection_name,
          params: params
        }
      };
    }

    // Allow ability to just pass the full "spec" to a lazy loaded view
    if (this.options.fetch_spec) {
      if (!_.isObject(this.options.fetch_spec)) {
        throw new Error('fetch_spec must be an object for lazy loaded views');
      }

      fetchSpec = this.options.fetch_spec;
    }

    this.setLoading(true);

    this._preRender();
    this.app.fetch(fetchSpec, fetchOptions, this._fetchLazyCallback.bind(this));
  }
function() {
    var params = {},
        fetchOptions,
        fetchSpec;

    if (this.options.fetch_params) {
      if (!_.isObject(this.options.fetch_params)) {
        throw new Error('fetch_params must be an object for lazy loaded views');
      }

      params = this.options.fetch_params;
    } else if (this.options.param_name) {
      params[this.options.param_name] = this.options.param_value;
    }

    if (this.options.fetch_options) {
      if (!_.isObject(this.options.fetch_options)) {
        throw new Error('fetch_options must be an object for lazy loaded views');
      }

      fetchOptions = this.options.fetch_options;
    }

    if (this.options.model_id != null) {
      params.id = this.options.model_id;
    }

    if (this.options.model_name != null) {
      fetchSpec = {
        model: {
          model: this.options.model_name,
          params: params
        }
      };
    } else if (this.options.collection_name != null) {
      fetchSpec = {
        collection: {
          collection: this.options.collection_name,
          params: params
        }
      };
    }

    // Allow ability to just pass the full "spec" to a lazy loaded view
    if (this.options.fetch_spec) {
      if (!_.isObject(this.options.fetch_spec)) {
        throw new Error('fetch_spec must be an object for lazy loaded views');
      }

      fetchSpec = this.options.fetch_spec;
    }

    this.setLoading(true);

    this._preRender();
    this.app.fetch(fetchSpec, fetchOptions, this._fetchLazyCallback.bind(this));
  }
function ( ) { var params = { } , fetchOptions , fetchSpec ; if ( this . options . fetch_params ) { if ( ! _ . isObject ( this . options . fetch_params ) ) { throw new Error ( 'fetch_params must be an object for lazy loaded views' ) ; } params = this . options . fetch_params ; } else if ( this . options . param_name ) { params [ this . options . param_name ] = this . options . param_value ; } if ( this . options . fetch_options ) { if ( ! _ . isObject ( this . options . fetch_options ) ) { throw new Error ( 'fetch_options must be an object for lazy loaded views' ) ; } fetchOptions = this . options . fetch_options ; } if ( this . options . model_id != null ) { params . id = this . options . model_id ; } if ( this . options . model_name != null ) { fetchSpec = { model : { model : this . options . model_name , params : params } } ; } else if ( this . options . collection_name != null ) { fetchSpec = { collection : { collection : this . options . collection_name , params : params } } ; } // Allow ability to just pass the full "spec" to a lazy loaded view if ( this . options . fetch_spec ) { if ( ! _ . isObject ( this . options . fetch_spec ) ) { throw new Error ( 'fetch_spec must be an object for lazy loaded views' ) ; } fetchSpec = this . options . fetch_spec ; } this . setLoading ( true ) ; this . _preRender ( ) ; this . app . fetch ( fetchSpec , fetchOptions , this . _fetchLazyCallback . bind ( this ) ) ; }
If rendered on the client missing its data,
fetch it based on the parameters passed in.
If rendered on the client missing its data fetch it based on the parameters passed in .