2017-05-08 18 views

答えて

4

あなたの質問にはheaderRowRendererが記載されていますが、実際にカスタムヘッダをレンダリングする方法について質問していると思います。セル残りのステートメントに基づいています。とにかく、私は両方を見せます。

// This is a custom header row rendered 
// You should used all of the specified params, 
// But you can also add your own decorated behavior. 
const headerRowRenderer = ({ 
    className, 
    columns, 
    style 
}) => (
    <div 
    className={className} 
    role='row' 
    style={style} 
    > 
    {columns} 
    </div> 
) 

// This is a custom header example for a single cell 
// You have access to all of the named params, 
// But you don't necessarily need to use them all. 
const headerRenderer = ({ 
    columnData, 
    dataKey, 
    disableSort, 
    label, 
    sortBy, 
    sortDirection 
}) => (
    <div>#</div> 
) 

const renderTable = (props) => (
    <Table 
    {...props} 
    headerRowRenderer={headerRowRenderer} 
    > 
    <Column 
     dataKey='number' 
     headerRenderer={headerRenderer} 
     width={100} 
    /> 
    <Column 
     dataKey='name' 
     label='Name' 
     width={200} 
    /> 
    </Table> 
) 

はここであなたのためのPlnkrの例です:https://plnkr.co/edit/eHr3Jr?p=preview

+0

「どのようにあなたの文の残りの部分に基づいてカスタムヘッダーセルをレンダリングする」 - 正確に!素晴らしい仕事をありがとう。 –

関連する問題