⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Displaying information from another table in read/edit view



Prout

Prout
  • profile picture
  • Member

Posted 23 August 2013 - 15:25 PM

Hi,

 

I have gone through a few topics on the forum and I've seen some elements of answers but I can't find a definite answer.

 

I'm trying to display information from another table in the read/edit view. In my example, it's displaying comments against a customer.

 

Displaying customer information is fine but then displaying all the comments for that customer on the read view is tricky.

 

The solution, I've seen so far seem to talk about callback and writing your own model.

 

Without going in and modifying the Grocery CRUD library, how could this be achieved?

 

tables structure:

 

CLIENT

id

title

firstName

lastName

 

COMMENTS

id

comment

clientId <--- id of the client for which the comment relates to (there could be more than one comment per client)

 

As I'm a grocery CRUD newbie, I'm taking any piece of code you could provide! :rolleyes:

 

Thanks!

 

 


davidoster

davidoster
  • profile picture
  • Member

Posted 23 August 2013 - 22:51 PM

Hello and welcome to the forums [member=prout].

Do you mean something like this?

http://eletter.gr/temp/gc1_4/index.php/test/multigrids2/3028

*press the blue button on the first column under customers


Prout

Prout
  • profile picture
  • Member

Posted 27 August 2013 - 12:04 PM

Hi David,

 

sorry for the late reply, the Grocery CRUD email ended up in my junk!!!!

 

What you've done is sort of what I'm looking for.

 

Ideally, it's showing the read view with the extra information at the top (as oppose to the list view in your example) and have a customized display (as oppose to the list display for each of your item - customers, attendance, etc). But I guess that's a good start.

 

Could you tell me how you achieved this? where did you put the code to call and display the additional information?

 

Thanks! :rolleyes:


davidoster

davidoster
  • profile picture
  • Member

Posted 27 August 2013 - 12:26 PM

Give me a couple of days time to finish what I am doing and I will make an elaborate example of how this can be achieved.


Prout

Prout
  • profile picture
  • Member

Posted 27 August 2013 - 13:24 PM

Ok thanks, can't wait!!!!!!!!

:ph34r:  :ph34r:  :ph34r:  :ph34r:


Prout

Prout
  • profile picture
  • Member

Posted 19 September 2013 - 14:20 PM

Hi David,

 

just wanted to know if you managed to work out an example?

 

Cheers


davidoster

davidoster
  • profile picture
  • Member

Posted 20 September 2013 - 20:05 PM

Sorry for this! I knew I was forgetting something.

I haven't managed to make an example so I will just share the actual code for it, which I should have done by the first day.

Sorry about this :/

Also [member=amit shah] was asking for this code.So here it is: https://dl.dropboxusercontent.com/u/37325099/multigrids_master_details.zip


Prout

Prout
  • profile picture
  • Member

Posted 20 September 2013 - 20:39 PM

Hi David,

 

thanks for this. I'll dig into your code and try to work out an example!

 

Thanks again :)


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 24 September 2013 - 09:50 AM

Thanks David, i too will look into the same.. and sorry to have missed you and the forum for long :)