src/datalist.js
function ( target, store, template, options ) {
		var ref = [store],
		    obj, instance;

		if ( !( target instanceof Element ) || typeof store !== "object" || !regex.string_object.test( typeof template ) ) {
			throw new Error( label.error.invalidArguments );
		}

		obj = element.create( "ul", {"class": "list", id: store.parentNode.id + "-datalist"}, target );

		// Creating instance
		instance = new DataList( obj, ref[0], template );

		if ( options instanceof Object) {
			utility.merge( instance, options );
		}

		instance.store.datalists.push( instance );

		// Rendering if not tied to an API or data is ready
		if ( instance.store.uri === null || instance.store.loaded ) {
			instance.refresh();
		}

		return instance;
	}
function ( target, store, template, options ) {
		var ref = [store],
		    obj, instance;

		if ( !( target instanceof Element ) || typeof store !== "object" || !regex.string_object.test( typeof template ) ) {
			throw new Error( label.error.invalidArguments );
		}

		obj = element.create( "ul", {"class": "list", id: store.parentNode.id + "-datalist"}, target );

		// Creating instance
		instance = new DataList( obj, ref[0], template );

		if ( options instanceof Object) {
			utility.merge( instance, options );
		}

		instance.store.datalists.push( instance );

		// Rendering if not tied to an API or data is ready
		if ( instance.store.uri === null || instance.store.loaded ) {
			instance.refresh();
		}

		return instance;
	}
function ( target , store , template , options ) { var ref = [ store ] , obj , instance ; if ( ! ( target instanceof Element ) || typeof store !== "object" || ! regex . string_object . test ( typeof template ) ) { throw new Error ( label . error . invalidArguments ) ; } obj = element . create ( "ul" , { "class" : "list" , id : store . parentNode . id + "-datalist" } , target ) ; // Creating instance instance = new DataList ( obj , ref [ 0 ] , template ) ; if ( options instanceof Object ) { utility . merge ( instance , options ) ; } instance . store . datalists . push ( instance ) ; // Rendering if not tied to an API or data is ready if ( instance . store . uri === null || instance . store . loaded ) { instance . refresh ( ) ; } return instance ; }
Creates an instance of datalist

@method factory
@param  {Object} target   Element to receive the DataList
@param  {Object} store    Data store to feed the DataList
@param  {Mixed}  template Record field, template ( $.tpl ), or String, e.g. "<p>this is a {{field}} sample.</p>", fields are marked with {{ }}
@param  {Object} options  Optional parameters to set on the DataList
@return {Object}          DataList instance
Creates an instance of datalist