Sha256: 86782ce648560b22206a238b65d5304930f8ff554cf37f6fd6dd15eec22fa5f1

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

class Lanes.Components.Grid.Header extends Lanes.React.BaseComponent

    propTypes:
        query: React.PropTypes.instanceOf(Lanes.Models.Query).isRequired
        cellStyles: React.PropTypes.object.isRequired
        onColumnClick: React.PropTypes.func

    onColumnClick: (f) ->
        @props.query.setSortField(f)
        @props.onColumnClick?(f)
        @forceUpdate()

    renderHeader: (f, i) ->
        return unless @props.cellStyles.props[i]
        sorted = f.sortable and @props.query.sortField is f
        classNames = _.classnames(
            sort:  f.sortable
            asc:   sorted and @props.query.sortAscending
            desc:  sorted and not @props.query.sortAscending
            @props.cellStyles.props[i].className
        )
        <div key={i}
            {...@props.cellStyles.props[i]}
            onClick={_.partial(@onColumnClick, f)}
            className={classNames}
        >
            <span className='l'>{f.title}</span>
        </div>

    render: ->
        columns = @props.query.fields.map @renderHeader

        <div className="header">
            {columns}
        </div>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lanes-0.5.6 client/lanes/components/grid/Header.cjsx
lanes-0.5.5 client/lanes/components/grid/Header.cjsx
lanes-0.5.0 client/lanes/components/grid/Header.cjsx
lanes-0.4.0 client/lanes/components/grid/Header.cjsx
lanes-0.3.0 client/lanes/components/grid/Header.cjsx