Displaying one to many relationships

Discuss MySQL Ajax Table Editor

Displaying one to many relationships

Postby markeh on Tue Mar 20, 2012 10:15 pm

Hi everyone,

I'm hoping someone would be kind enough to give me some advice or point me in the right direction with a problem I'm having. I have customers which can be a member of several groups and I'm struggling with how I can work with this using MATE.

For example I have:

a customer table - customer_id, customer_name, customer_email
a group table - group_id, group_name
a customerGroup junction table - customer_id, group_id

I use MATE for the customers table, how can I also display the groups the customer is in? and then add a customer to or delete a customer from those?

I'm hoping there is an example of something similar being done, it seems like something that might be commonly performed. I hope I've explained this well, any help or advice would be very much appreciated.
markeh
 
Posts: 1
Joined: Tue Mar 20, 2012 9:53 pm

Re: Displaying one to many relationships

Postby KarelB on Thu Mar 22, 2012 9:29 am

Straight out of the box MATE does not handle one to many relationships.
This doesn't mean you cannot create something yourself.

There are forum discussions on master-detail grids you could use or
I solve this issue in the following way:
- create a new icon
- clicking the icon passes the record id and starts a jQuery dialog
- the jQuery dialog opens an iframe with a new MATE page with the many relations for that particular record.
KarelB
 
Posts: 414
Joined: Mon Dec 01, 2008 11:49 pm
Location: The Netherlands

Re: Displaying one to many relationships

Postby admin on Mon Mar 26, 2012 2:52 pm

This should be possible with mate. Did you try making the junction table the main mate table and do joins on the other two? Take a look at the join example on how to do this.

With this method you will be able to add and delete customers from groups. In order to add a new customer or group you can create a custom icon that triggers a modal box or pop up window like KarelB was saying.
admin
Site Admin
 
Posts: 1287
Joined: Fri Jul 11, 2008 1:34 am


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron