if 문을 실행할 수 없습니다.

네오슬로

이것이 쉬운 해결책이라고 생각하지만 왜 내 if 문과 관련하여 오류를 제거할 수 없는지 이해하는 데 어려움을 겪고 있습니다.

내 if 문과 관련하여 여러 구문 오류가 발생합니다. if (selectedDate < new Date().toISOString().split('T')[0]) { selectableRows: "none" }

반환(selectableRows: "none")을 추가하려고 시도했지만 내 문제도 해결되지 않았습니다.

 const custom = {
        customToolbar: () => <DataTableRefreshButton refresh={refresh} />,
        customToolbarSelect: (selectedRows, displayData) => (
            <TestToolBar
                data={data}
                alert={alert}
                rows={rows}
                type={type}
            />
        ),
        isRowSelectable: (displayData) => {

            const data= updatedStaff[
                data
            ];
         return (currentData.ActionTypeID > 0 || currentData.ActionCompletedByID > 0   ? false : true)
        },
         if (selectedDate < new Date().toISOString().split('T')[0]) {
        selectableRows: "none"
        }
    };

데이비드

단순화하면 다음과 같은 구조가 있습니다.

const custom = {
    firstProperty: 1,
    secondProperty: 'test',
    if (someCondition) {
        thirdProperty: 'third'
    }
};

이것은 유효한 자바스크립트가 아닙니다. if여러 문장을 작성할 때 블록 을 사용할 수 있지만 객체의 속성을 설정하는 도중에는 사용할 수 없습니다.

해당 속성에 유효한 기본값이 있는 경우 삼항 조건 연산자를 사용하여 설정할 수 있습니다.

const custom = {
    customToolbar: ...
    customToolbarSelect: ...
    isRowSelectable: ...
    selectableRows: (selectedDate < new Date().toISOString().split('T')[0]) ? 'none' : 'default'
}

그렇지 않으면 개체를 더 동적으로 빌드해야 할 수 있습니다. 다음과 같은 것:

const custom =
    (selectedDate < new Date().toISOString().split('T')[0])
    ? { /* properties with selectableRows */ }
    : { /* properties without selectableRows */ }

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

문을 실행할 수 없습니다.

swirl ()을 실행할 수 없습니다.

goinstall을 실행할 수 없습니다.

netcat을 실행할 수 없습니다.

InvokeCommandAction을 실행할 수 없습니다.

Constraintlayout을 실행할 수 없습니다.

PHPUnit을 실행할 수 없습니다.

PHPUnit을 실행할 수 없습니다.

onClick을 실행할 수 없습니다.

Freshclam을 실행할 수 없습니다.

case 문 내에서 ifelse 문을 실행할 수 없습니다.

Hibernate 4.3에서 문을 실행할 수 없습니다.

SQL 문장을 두 번 실행할 수 없습니다

org.hibernate.exception.SQLGrammarException : 문을 실행할 수 없습니다.

org.hibernate.exception.ConstraintViolationException : 문을 실행할 수 없습니다.

SQLGrammarException : 문을 실행할 수 없습니다 (PostgreSQL + Hibernate).

R의 sqldf에서 JDBC 문을 실행할 수 없습니다.

Json gem 때문에 레일을 실행할 수 없습니다.

org.hibernate.exception.GenericJDBCException : 문을 실행할 수 없습니다.

if 문을 완전히 실행할 수 없습니다.

명령 실행을 실행할 수 없습니다 .-- release

Nginx 실행 파일을 실행할 수 없습니다.

실행 파일을 전혀 실행할 수 없습니다.

실제 Apple Watch에서 앱을 실행할 수 없습니다.

select 문으로 함수를 실행할 수 없습니다.

if isset 때문에 함수를 실행할 수 없습니다.

sudo없이 도커 명령을 실행할 수 없습니다.

Gradle : FAILURE : 실행할 작업을 결정할 수 없습니다.

앱을 실행할 때 listView를 표시할 수 없습니다.