[英]Defining associations in ExtJS
I have three tables in my database. 我的数据库中有三个表。 They are Student , Subject and Mark .
他们是学生 , 学科和马克 。 Student has these fields: id , name , address .
学生有以下字段: id , name , address 。 Subject has these fields: id , name .
主题具有以下字段: id , name 。 And Mark has these fields id , studentId , subjectId and mark .
并且Mark具有以下字段id , studentId , subjectId和mark 。 So, here I have these associations like Student can have many subject and one subject has one mark .
因此,在这里我有这些联系,例如学生可以有很多科目,而一个科目只有一个分数 。 So, how can I define these relations in MVC pattern like placing them in Model and Store.
因此,如何在MVC模式中定义这些关系,例如将它们放置在“模型”和“存储”中。 I want to display the information like student_name, student_address, subject_name and marks in my grid panel.
我想在网格面板中显示诸如student_name,student_address,subject_name和标记之类的信息。 But I having trouble associating them in Model and Stores.
但是我在将它们关联到模型和商店时遇到了麻烦。
Take a look at the docs of the model and the reader . 看看模型的文档和读者 。 There you will find enough information to get you started.
在这里,您将找到足够的信息以开始使用。
After reading the docs you can take a look at the tutorials of MiamiCoder , ModusCreate and this one .. 阅读文档后,您可以看一下MiamiCoder , ModusCreate和这一个的教程。
I just made sometime ago a fiddle that show how association works. 不久前,我做了一个小提琴,展示了联想如何工作。 You can see json example also.
您还可以看到json示例。
When you catch the basics, rest should be easier to understand. 当您掌握基本知识时,应该更容易理解休息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.