D
D
Dan2021-05-12 00:25:06
typescript
Dan, 2021-05-12 00:25:06

It is necessary to display the number of selected checkboxes in the button, how to do this in this case?

function commonCollectOrderDesktop(collect_order: ViewModel.CollectOrder, state: State, index: number) {
  return (<tr key={index}>
    <td><input type="checkbox" className='check'/></td>
    <td>{collect_order.id}</td>
    <td>{getObjectByIdAndName(collect_order.warehouse_id, state.array_of_warehouse)}</td>
    <td>{getObjectByIdAndName(collect_order.legal_entity_id, state.array_of_legal_entity)}</td>
    <td>{collect_order.creation_date_time}</td>
    <td>{collect_order.count_of_product}</td>
  </tr>);
}

{state.array_of_collect_order.length > 0
      ? (<button onClick={(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
        event.preventDefault();
        console.log(state.array_of_collect_order)
        for (let i of state.array_of_collect_order) {
          console.log (i["id"])-это для тестов
        }
      }}>Собрать&nbsp;
        {state.array_of_collect_order.length}&nbsp;  -вместо длины  стейта массива здесь должно быть кол выбранных чекбоксов
        {defineTitle((state.array_of_collect_order.length), "заказ", "заказа", "заказов")}
      </button>)
      : null
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question