         setSelection: React.PropTypes.func
         displayLimit: React.PropTypes.number
         syncOptions:  React.PropTypes.any
+        fetchWhenOpen: React.PropTypes.bool
+
+    getDefaultProps: ->
+        labelField: 'label', idField: 'id', displayLimit: 30, syncOptions: {}, fetchWhenOpen: true
 
     dataObjects:
+        model: 'props'
         collection: ->
             @props.collection || (
-                @props.model?.associations.collectionFor(@props.name, @props.model)
+                @props.model?.associations?.collectionFor(@props.name, @props.model)
             )
 
-    onChange: (selection) ->
-        return unless  _.isString(selection)
-        order = @props.queryOrder || { "#{@props.labelField}": 'desc' }
-        options = { limit: @props.displayLimit, order}
-        unless _.isEmpty(selection)
-            options.query = {
-                "#{@props.labelField}": { op: 'like', value: selection }
-            }
-
-        @collection.fetch(options)
-
-    onSelect: (selections) ->
+    onChange: (selections) ->
         selections = [selections] unless _.isArray(selections)
         records = _.map selections, (selection) =>
             @collection.get(selection.id)

            return selection if selection

        selected = @getCurrentModel()
        if selected
            {id: selected[@props.idField], label: selected[@props.labelField]}
        else
            {id: null, label: ''}


    renderDisplayValue: ->
        <span>{@getCurrentSelection()?.label}</span>

    _getChoices: ->
        selection = @getCurrentSelection()
        if @state.isOpen
            if _.isFunction(@getChoices) then @getChoices() else
                labelField = @props.labelField
                rows = @collection.map (model) ->
                    {id: model.id, label: _.result(model, labelField)}
                # # add the current selection if the rows from the collection don't include it
                # unless @collection.get( selection.id )
                #     rows.push(selection)
                if _.isEmpty(rows) then [@getCurrentSelection()] else rows
        else
            if selection then [selection] else []

    onToggle: (isOpen) ->
        @collection.fetch(
            _.extend(limit: @props.displayLimit, Lanes.u.invokeOrReturn(@props.syncOptions))
        ) if isOpen
        @setState({isOpen})

    renderEdit: (label) ->
        Component = if @props.multi
            Lanes.Vendor.ReactWidgets.Multiselect
        else

            else
                null
        else
            value

    getCurrentSelection: ->
        if @props.getSelection
