Jump to content


Master/details forms with Grocery CRUD


  • Please log in to reply
25 replies to this topic

#21 ssfthurber

ssfthurber

    Member

  • Members
  • PipPip
  • 27 posts

Posted 22 August 2013 - 12:32 PM

i'm thinking of doing a little master-detail magic via the multiple cruds per screen feature of 1.4 but i cannot find any documentation of the api for that feature. perhaps it is as simple as appending multiple render results or having callbacks that call public functions that contain cruds. anyone know how this new feature works?



#22 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 23 August 2013 - 04:33 AM

John, master/details forms are somothing more like this:

http://holowczak.com...ds_md_step6.jpg

imagine to have a table with the data of your Audio CD library with all
the information about the CDs and another table with the data regarding each
single audio track. You want to put all in one single form in the way that while
you change the record in the master table (CDs information) even the list of
all the audio tracks changes.
Anyway, I think Steve is doing a great job with his fork and I would like
to use Grocery instead of Datatable because I think is more easy to use it
with CodeIgniter.
Thanks!

can you attach the image as the link provided has expired.



#23 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 23 August 2013 - 11:21 AM

Well after version 1.4 there is a way to make a Master/Details form, but the page refreshes.

Check here

 

and press the button the arrow shows here,

prsj.png


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#24 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 24 August 2013 - 09:13 AM

i know this can be achieved .. but it will be great if you can share the code.. i may have a work around to get the details without refreshing.. using ajax calls and stuff.



#25 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 24 August 2013 - 10:15 AM

i know this can be achieved .. but it will be great if you can share the code.. i may have a work around to get the details without refreshing.. using ajax calls and stuff.

 

We already checked with John. Currently even if you try to use ajax calls so the page doesn't refresh you end up with this, which has many problems on the javascript part of the code. In order to have a proper one, without refreshes, John needs to make enhancements to the library.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#26 edramirez

edramirez

    Advanced Member

  • Members
  • PipPipPip
  • 63 posts
  • LocationMetro Manila

Posted 09 October 2013 - 03:32 PM

Master-detail functionality is already present in version Grocerycrud 1.4.1 but it's not in the way that many are used to seeing. What you do is to create the usual tabular view for master table which has an add_action functionality to send the user to the controller file containing the grocerycrud tabular view for the detail table.

 

The controller for the detail table does 3 things:

(1) display the pertinent fields of the master table so that the user will know the parent (master table record) of the child (detail) record that he is viewing;

(2) display the grocerycrud tabular view for that detail table; and

(3) display the "Back to ... " (back to the master table)

These three can be implemented in two separate views strung together in sequence.

 

The beauty about grocerycrud is that it has what I call "persistent view". This means that a tabular view will continue to stay its page even after you perform another operation. So, when your program opens the controller containing the detail table, the tabular view might disappear from the screen temporarily. But after the user selects the "Back to.." button mentioned in number 3, the controller for the detail closes and the master controller reopens exactly on the page where you previously left it!

 

If you worked with CodeIgniter's pagination long enough, you will realize the critical relationship between the url and the page. In the same manner, grocerycrud's view is controlled by the url displayed. I've never succeeded in putting together more than one grocerycrud object in one controller. I'm not saying that it can't be done because there is probably a way using ajax. But to accomplish master-detail with the least effort and least coding using pure CodeIgniter and GroceryCrud, you need to limit a single GroceryCrud object for one controller.

 

I have a sample code based on a small project I tackled recently: http://www.grocerycr...-master-detail/ (However, there is a better way to do this when handling big tables based on both master and detail table specifications having multiple keys.)

 

The good news is that there's no need to wait for the next version of grocerycrud to handle this feature because you can do it already.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users