                     rowHeight={@props.rowHeight}
                     dataSource={@dataSource}
                     paginationFactory = {@makeToolBar}
-                    selected={@getSelected()?.id}
+                    selected={@state.selectedModel?.id}
                     sortInfo={@state.sortInfo}
                     onSortChange={@onSortChange}
                     onSelectionChange={@onRowClick}


            <div className='wrapper'>

                {@renderEditor() if @canEdit() and @state.selIndex?}

                <Lanes.Vendor.Grid
                    ref="grid"

        for sortConfig in sortInfo
            sort = @query.fields.at(sortConfig.name).sortBy
            sortConfig.fn = sort if sort

        @setState(sortInfo: sortInfo, selectedIndex: undefined, selectedModel: undefined)

    hideEditor: -> @setState(selectedIndex: null)

    onEditCancel: (model) ->
        if model.isNew()
            @query.results.removeRow(@state.selectedIndex)
        this.hideEditor()

    onEditSave: (model) ->
        @query.results.saveModelChanges(model, @state.selectedIndex)

        this.refs.grid.data[this.state.selectedIndex] =
            @query.results.rowAt( @state.selectedIndex, visibleOnly: true )

        this.hideEditor()

    renderEditor: ->
