Jump to content

Adding child data dynamically

  • Please log in to reply
2 replies to this topic

#1 azielinsky



  • Members
  • Pip
  • 1 posts

Posted 23 November 2013 - 11:02 PM

Hello there.I think i'm bringing a challenging question to the table.


Let's imagine that i have a model where i have Offices and Employees that work at each office and each one has the corresponding office_id


I'm trying to achieve a form where for example if i'm editing/creating an office and i want to put a button where i can add employees dynamically without exiting the Office form.


Here is an example of the functionality using grocery CRUD but i haven't manage to replicate it


Does anyone have an idea of where should i start


Thanks in advance for your help


#2 Amit Shah

Amit Shah

    grocery CRUD Master

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

Posted 24 November 2013 - 05:25 AM

Hi azielinsky


Nice question. I will like to share this a scenario as how you can go about on the same. But this is possible only after the office is added. Cuz that will give ability to assign the newly created office id. Of course this will require a certain tweeks but surely should work out.

Here is what i can suggest..

If you doing it all from read ... great - no need to deal a lot of this ..

THE READ WAY - Where you can add 2 column and have a callback_column on both

1 - add for a button

2 - add space / iframe.

Also you have to add up a script that will execute the function to call up the employee grid into the iframe with pre-passed office id ... that can go as hidden value with the employees being added out there.


IF you planning to do the same with Add form -

What you need to do is = follow up almost the same things as for the READ state - but an additional stuff would be - u need to add callback after insert (of each employee) and store the ID of each employee added for the new office into the session.

And you need to add one callback after insert (for the office) and there you have to assign the generated office id to all the employees in the session.


I know looks a little complex but a doable solution for sure ....


Happy GCing :)

#3 ari



  • Members
  • Pip
  • 3 posts

Posted 22 December 2013 - 04:37 AM

Any body can do that with standard grocerycrud data example and put into grocerycrud master example ?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users