Jump to content


Master/details forms with Grocery CRUD


  • Please log in to reply
25 replies to this topic

#1 tuareg

tuareg

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 18 January 2012 - 01:14 PM

Hello! I am new to Grocery and first of all, my compliments: it's wonderfull! :-)
What about master/details forms ? ( http://en.wikipedia....etail_interface )
Can I build one with Grocery ?
Can you give me some start points?
Thkx a lot!
Bye!

#2 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,099 posts
  • LocationLondon

Posted 18 January 2012 - 07:17 PM

Hello there and welcome to the forum,

As I understood you mean something like this - http://datatables.ne...ow_details.html - right?
Actually the CRUD is always extending and extending. So at the first releases there where not relations, not uploading, not multilingual e.t.c. e.t.c. so as a future feature I plan to have something like this.
For now there is no such a thing and I don't know any one that have a similar extension for this to help you.

So my advice is to learn the benefits of grocery CRUD and try to learn it and work with it, and after this if you see that you really want many more to your grid you can see datatables as has many examples of how to add things to your grid.You can of course have both to your project without any problem, but try to use it seperately to don't have conflicts. If you though want to change the grocery CRUD to work with master/details forms you will need to change some things to the main library and this is not suggested as you will have problem with the updates. If you make this decision I am here to help you with anything ;)

Kindest Regards
John
Posted Image

#3 steveoc

steveoc

    Member

  • Members
  • PipPip
  • 22 posts

Posted 19 January 2012 - 11:46 AM

Thats effectively what I am doing with chaining CRUD forms together - when the first form is in edit/view mode, the second form appears below this - initially with a list of the related items that match the primary key of the first form.


The code looks something like this :
$form1 = new grocery_CRUD();
... add things to the first form

$form2 = new grocery_CRUD();
... add things to the second form

$form2->chain_to($form1, 'name_of_key_field');

$form1->render();

Grocery CRUD does the rest from there - it only brings up the 2nd form after a record is selected for editing in the first form.

I really must get around to cleaning up the rest of the code - and writing some documentation for this. Still has some issues with datatables, but flexigrid works really well for this setup. Another week of holidays, and Ill attack it again :) Might take several weeks to clean up at this rate.

In the meantime, you can always grab the modified version from https://github.com/s.../zipball/master (My github branch) - install that in a test area, and see how it works for you, bugs and all :)

Edit: Or you can see the forked github project at: https://github.com/s...64/grocery-crud

Edited by web-johnny, 14 April 2012 - 10:12 AM.
Add the github project information


#4 tuareg

tuareg

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 19 January 2012 - 03:56 PM

As I understood you mean something like this - http://datatables.ne...ow_details.html - right?


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

http://holowczak.com/oracle/dev9i/f9ids_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!

#5 tuareg

tuareg

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 19 January 2012 - 03:57 PM

Thanks a lot Steve!
You are doing a great work!
I am going to test it as soon as I can!
Bye.

#6 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,099 posts
  • LocationLondon

Posted 19 January 2012 - 05:24 PM

Now I understood.

Yes I think @steveoc has this thing that you want. So I think this solution could work well for you.

Thanks @staveoc for your time. I also think that you do a great work.
Posted Image

#7 steveoc

steveoc

    Member

  • Members
  • PipPip
  • 22 posts

Posted 19 January 2012 - 10:05 PM

Thanks for the link to the oracle forms picture - that is quite interesting ... and brings back a few memories of using Oracle forms. Quite ahead of it's time, but horrible to program in. Thank heavens we have PHP now. There is a lot of 'best practice' stuff out there from the good old days of programming - like Oracle forms, etc ... it would be very cool to re-implement these old school ideas using the latest tools - PHP / jQuery / CSS. We really are on a winner with this.

Johnny has been going gang-busters getting some excellent new changes in place for relation fields (both 1-n, and n-n), and various css updates as well. I will try merging these in this weekend if I get some time between cycling events.

Other than that, I would love to get feedback from testers of my forked code. What I have done suits my needs, but other people may have extra requirements that I havent even thought about yet. So keep the ideas flowing please. Like I said above though, the datatables code is quite lagging, as I have been putting my efforts into flexigrid so far. I will fix that though.

It very encouraging so see these high quality contributors hitting this forum as well - including great ideas, code patches and other thoughts. This bodes well. GC is going to be one killer library at this rate ... looking forward to 2012 already !

#8 goFrendiAsgard

goFrendiAsgard

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 02 February 2012 - 01:00 PM

Hi guys, first of all, you do a great job, steveoc. You make grocery CRUD even better. I just download your modification, and I'll try it soon.

And John, do you plan to merge this to the main branch (just want to know)

No-CMS homepage : http://www.getnocms.com
No-CMS forum : http://www.getnocms.com/forum
No-CMS Github page : https://github.com/g...diAsgard/No-CMS

 

Please don't mix up No-CMS and groceryCRUD issues.
(eg: user authentication etc is No-CMS specific issue and has nothing to do with groceryCRUD)

 


#9 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,099 posts
  • LocationLondon

Posted 03 February 2012 - 06:58 PM

I am waiting for @steveoc to finish what he has done and we will try to merge it to the new version 1.2 (not yet released). So the answer is yes, but I still don't know if the merge will be at the main release or just to the forked one. Probably it will be at the forked but it doesn't really matter if the last forked is merged with the last release.
@staveoc if you need any help just PM to me.
Posted Image

#10 goFrendiAsgard

goFrendiAsgard

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 04 February 2012 - 08:22 AM

@Johnny, very good.
@steveoc, just do it man, that's why I like open source guys, let's us know if you need a hand ;)

BTW I got some accidental interesting result by write this :
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class GCTry extends CI_Controller {

public function __construct(){
  parent::__construct();
  /* Library wajib */
  $this->load->database();
  $this->load->helper('url');
  $this->load->library('grocery_CRUD');
  /* ------------- */

}

public function index()
{
  echo "hallo, this is just a try";
}

public function office(){
  $crud = new grocery_CRUD();
  $crud->set_table('offices');
  $crud->set_theme('datatables');

  //$crud->add_action('Detail', '', 'administrator/photos','ui-icon-image',array($this,'employee'));
  $crud->add_action('Employee', '', 'coba/employee');

  $output = $crud->render();
  $this->load->view('example', $output);

}

public function employee($officeCode){

  $crud = new grocery_CRUD();
  $crud->set_table('employees');
  $crud->where('officeCode', $officeCode);

  $crud->callback_before_insert(array($this,'before_insert_employee'));

  $output = $crud->render();
  $this->load->view('example',$output);

}

public function before_insert_employee($post_array){
  $totalSegment = $this->uri->total_segments();

  $str = '';
  for($i=0; $i<$totalSegment; $i++){
   $str .= '_'. $this->uri->segment($i);
  }

  $post_array['email'] = $str;
  $post_array['officeCode'] = $this->uri->segment($totalSegment-1);
  return $post_array;

}
}
/* End of file coba.php */
/* Location: ./application/controllers/coba.php */

I use groceryCRUD default database example, and surprisingly I got employees grouped by their office code.
I don't look at grocery_crud library in detail yet, but i believe it is related.

No-CMS homepage : http://www.getnocms.com
No-CMS forum : http://www.getnocms.com/forum
No-CMS Github page : https://github.com/g...diAsgard/No-CMS

 

Please don't mix up No-CMS and groceryCRUD issues.
(eg: user authentication etc is No-CMS specific issue and has nothing to do with groceryCRUD)

 


#11 steveoc

steveoc

    Member

  • Members
  • PipPip
  • 22 posts

Posted 04 February 2012 - 12:55 PM

Hi guys ... am back on the case !

My TODO list is getting longer by the day, so I keep getting a little side tracked :)

Only a few small fixes to go in with my GC branch (Ajax, datatables support, etc), and then I will merge with 1.2 when that is out. Git makes it very easy to manage all the forking though, so thats no drama.

Other than that, I will try and merge in some newer code which enables each form to have an array of child forms - so its a tree structure of forms rather than a linked list. Getting that working is not trivial, so I will concentrate on that, and try to stop getting side tracked :)

Talk soon

#12 goFrendiAsgard

goFrendiAsgard

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 05 February 2012 - 02:28 AM

@steveoc Nice to hear from you ;)

No-CMS homepage : http://www.getnocms.com
No-CMS forum : http://www.getnocms.com/forum
No-CMS Github page : https://github.com/g...diAsgard/No-CMS

 

Please don't mix up No-CMS and groceryCRUD issues.
(eg: user authentication etc is No-CMS specific issue and has nothing to do with groceryCRUD)

 


#13 vnt

vnt

    Advanced Member

  • Members
  • PipPipPip
  • 54 posts

Posted 22 February 2012 - 02:30 PM

the next version 1.2 will be very interesting!

#14 naufal

naufal

    Member

  • Members
  • PipPip
  • 18 posts

Posted 11 March 2012 - 05:24 PM

Hello everyone, thanks for this great tools. i want to report about bugs groceryCRUD modification's by steveoc. When i insert child field (form2), it return json data to browser.
{"success":true,"insert_primary_key":15,"success_message":"<p>Your data has been successfully stored into the database. <a href='http:\/\/localhost\/grosir\/index.php\/examples\/car_management\/edit\/1\/edit\/15'>Edit Record<\/a> or <a href='http:\/\/localhost\/grosir\/index.php\/examples\/car_management\/edit\/1'>Go back to list<\/a><\/p>"}
.
And the second is if i insert row more than 10 the button > next page is not working

EDIT : it is solved, jquery link missed.

#15 mryasir

mryasir

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 20 April 2012 - 01:23 PM

As i am having same problem.Can you please point out Which jquery link you missed.

#16 rjsig

rjsig

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 24 April 2012 - 03:20 PM

Stevoc or someone who knows, as of this msg, 04/24/2012, are your changes merged with the latest release of gc? I am insistent on not changing core on tools because I want them always up to date and take advantage of the brilliant minds that work so hard on the advancements.

Also, probably a really basic question, but I can not see the answer. I simply, in addition to the normal operations of gc as I understand them at this time, want to have a view only option to the exclusion of add, edit, delete.

When I implemented your excellent integration of what I thought would give me that and unset the the edit, it also unsets the view only. I looked at the code and thought I had found one or more ways to achieve it but alas, not. When I unset edit it unsets view only and when I unset view only it does actually unset just view only. I feel like I'm missing something simple in regards to how to properly use your changes to achieve my purpose.

I'm creating a web app called LIPSapp™. I need visitors - not yet registered or not signed in - to be able to, for example, View a list of Venues, which works fine. If they are not registered and logged in, I want them to be able to View-Only certain additional data in the form. I do not want them to be able to edit. In fact, I want editing limited to Admin and only logged in users with permission to edit particular venues.

Any advice is greatly appreciated.

#17 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,099 posts
  • LocationLondon

Posted 25 April 2012 - 07:04 AM

It is a long time that I didn't heart any news of steveoc. So the extension is not currently developed and ... no it is not merged with the new version.

Also the view functionality is a feature that it is not yet at grocery CRUD. It will be added at future version.

Kindest Regards
Johnny
Posted Image

#18 Felipe Matos

Felipe Matos

    Member

  • Members
  • PipPip
  • 11 posts

Posted 26 February 2013 - 01:29 PM

Hi,
 
Unfortunately it seems that @Steveov discontinuous the project. And until the @Asgard showed interesting solution, but in my case it would be kind of boring for the User, as the relationship is between 3 forms and 3 different tables.
 
Anyway, anyone have any other solution different? The ideal for me would be able to register it as if it were only one form.
 
Sorry my english.


#19 davidoster

davidoster

    Grocery CRUD Ninja

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

Posted 03 March 2013 - 08:18 AM

As it is being said before in various answers of this forum, we must wait till the Master/Detail feature is ready. But this will take time.


____________________________________________________________

 

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

____________________________________________________________

 

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


#20 php_lover

php_lover

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts

Posted 03 March 2013 - 09:02 AM

When MasterDetail feature available can we do something in this version






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users