0

Таблица blueprint.js выводит список пользователей, полученный от сервера:

const UsersPage = (props) => {

let arr = props.usersPage.usersList.map((userInfo) => {
    return [userInfo.id, userInfo.is_admin, userInfo.username]
});

let cellRenderer = (rowIndex, columnIndex) => {
    let cellKey = `cell_${rowIndex}_${columnIndex}`;
    switch (arr.length && arr[rowIndex][columnIndex]) {
        case true:
            return <Cell key={cellKey}>+</Cell>;
        case false:
            return <Cell key={cellKey}>-</Cell>;
        default:
            return <Cell key={cellKey}>{arr.length && arr[rowIndex][columnIndex]}</Cell>
    }
};
let cellDelRenderer = (rowIndex, columnIndex) => {
    let cellKey = `cell_${rowIndex}_${columnIndex}`;
    return <Cell key={cellKey} style={{cursor: 'pointer'}}>
        <Fragment>
            <span id={arr[rowIndex][0]} onClick={props.handleDelUser}
                  className={"bp3-icon bp3-icon-standard bp3-icon-cross"}/>
        </Fragment>
    </Cell>
};
return (

            <Table numRows={props.usersPage.usersList.length} columnWidths={[50, 65, 100, 40]}>
                <Column cellRenderer={cellRenderer}/>
                <Column cellRenderer={cellRenderer}/>
                <Column cellRenderer={cellRenderer}/>
                <Column cellRenderer={cellDelRenderer}/>
            </Table>
)

Данные о удалении успешно уходят на сервер. После с сервера запрашивается новый список пользователей для отреднера. На этом моменте вылетает ошибка:

Unhandled Rejection (TypeError): Cannot read property '1' of undefined

Подскажите, пожалуйста, хотя бы в каком направлении копать? Не могу понять где загвоздка.

1 ответ 1

0

Вопрос решился добавлением в таблицу "key": https://github.com/palantir/blueprint/issues/3757#issuecomment-567219231

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.