0
I have 2 tables
Table 1
[
{"Id": "1", "nome": "João"},
{"Id": "2", "nome": "Manoel"}
]
Table 2
[
{"Estudante": "1", "nota": "5", "avaliação": "1"},
{"Estudante": "1", "nota": "6", "avaliação": "2"},
{"Estudante": "1", "nota": "7", "avaliação": "3"},
{"Estudante": "1", "nota": "8", "avaliação": "4"},
{"Estudante": "2", "nota": "3", "avaliação": "1"},
{"Estudante": "2", "nota": "5", "avaliação": "2"},
{"Estudante": "2", "nota": "8", "avaliação": "3"},
{"Estudante": "2", "nota": "9", "avaliação": "4"}
]
I need to render this way
Estudante: Jose
Evaluation 1 | nota 5
Evaluation 2 | nota 6
Evaluation 3 | nota 7
Evaluation 4 | nota 8
Estudante: Mark
Evaluation 1 | nota 3
Evaluation 2 | nota 5
Evaluation 3 | nota 8
Evaluation 4 | nota 9
I am using v-Resource calling the data by PHP from Table 1 which is the student list and using V-FOR to display
<Div v-for="Estudante in Estudantes">
Estudante {{Estudante.nome}}
</Div>
Now I would need to within this first V-FOR, invoke another $HTTP.POST passing the ID to the query to bring me only the data related to the particular student within the loop.
How best to implement this system?
Imagine a universe of 10,000 students, I can’t bring all this data at once, so I need to call for ajax inside a pagination. Example I will show only the first 10 students, and I need to bring from the database by PHP only the grades of the first 10 students, so I would need to consult by POST the database passing the ID of each student displayed separately.
– Nixon Girard
@Nixongirard whenever you change the value of
data
of Vue he will run thecomputed
again.– Sergio