S
S
Soffeso2020-11-15 14:34:52
Yii
Soffeso, 2020-11-15 14:34:52

Creating dynamic tables in Yii2?

Good day. I am doing term paper and faced the following task:
We have in the database: Students, Groups and Subjects. And it is necessary that when choosing a group and subject, a table is displayed:

spoiler
5fb10aae5658b781074753.png

Moreover, the table must be editable, i.e. if you click on the corresponding cell, then you can edit it and save the data (in my case, grades). Here, I think, with the help of the DataTable Editor, I'll figure it out. But I don't understand how to create and display table data. In addition, there will be a lot of them (1 table only for 1 semester for the 1st group of the 1st subject). I understand that this is not an optimal solution, but I do not know how it can be done differently.
My ideas were:
1) As shown in the screenshot - you select a subject, select a group and a check occurs: if the table is created, then it is displayed, if not, it is created with the name: Subject ID_Group Number_Year of Study (example: 1_1212_2020 or 112122020)
2) Handles, with the help of migrations to create tables. (But, in my opinion, this is absurd)

But even if the 1st option is implemented, it is not entirely clear how to display it. After all, an appropriate model is needed to output data, and this, again, is done by hand.

Please put on the right path, maybe choose another framework that is more suitable for this task or do without them at all. Or store data in files (json, xml, etc.), but in this case I have no experience. In my head, it’s just, it’s already a mess and I’ve been suffering with this task for more than a week. There is no one to turn to for advice.

PS The curator says "Do it somehow, the main thing is that it works"

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