N
N
Nikita Shchypylov2018-03-19 15:24:03
React
Nikita Shchypylov, 2018-03-19 15:24:03

How to make this filter on Redux-form?

Hello.
How to properly filter categories on redux-form?
Actually, there are 5 positions with checkboxes and content. It looks something like this:
5aafaaebb4593432735881.jpeg
As I thought to do:
The default will be "All transplants". When a checkbox is clicked, I catch the clicked checkbox and extract a number from its id. Then you need to somehow show / hide blocks with flights with classes, because the data is crammed with hands. This is what json looks like:

{
  "tickets": {
    "ticket_1": {
      "image": "/img/logo.png",
      "price": "12 322",
      "departure": {
        "time": "09:25",
        "date": "9 oct 2016, Fr",
        "city": "VVO, Vladivostok"
      },
      "arrival": {
        "time": "12:05",
        "date": "9 oct 2016, Fr",
        "city": "TLV, Tel a vi"
      },
      "transfers": 0
    },
    "ticket_2": {
      "image": "/img/logo.png",
      "price": "12 322",
      "departure": {
        "time": "09:25",
        "date": "9 oct 2016, Fr",
        "city": "VVO, Vladivostok"
      },
      "arrival": {
        "time": "12:05",
        "date": "9 oct 2016, Fr",
        "city": "TLV, Tel a vi"
      },
      "transfers": 2
    },
    "ticket_3": {
      "image": "/img/logo.png",
      "price": "12 322",
      "departure": {
        "time": "09:25",
        "date": "9 oct 2016, Fr",
        "city": "VVO, Vladivostok"
      },
      "arrival": {
        "time": "12:05",
        "date": "9 oct 2016, Fr",
        "city": "TLV, Tel a vi"
      },
      "transfers": 3
    }
  },
  "filters" : [
    {
      "text": "All transfers",
      "name": "all_transfers"
    },
    {
      "text": "No transfers",
      "name": "no_transfers"
    },
    {
      "text": "1 transfer",
      "name": "1_transfer"
    },
    {
      "text": "2 transfers",
      "name": "2_transfers"
    },

    {
      "text": "3 transfers",
      "name": "3_transfers"
    }
  ]
}

Questions:
1) How to determine if a checkbox is clicked? Is it possible to do this without clicking on the submit, asynchronously?
2) Is it correct to show/hide flights by classes? Or is there a better way, considering that there is no read/write capability?
Thanks

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