⚠ 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

Master/details forms with Grocery CRUD



tuareg
  • profile picture
  • Member

Posted 18 January 2012 - 13: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!

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 18 January 2012 - 19: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

steveoc
  • profile picture
  • Member

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 :)

[b]Edit: Or you can see the forked github project at: [/b]https://github.com/steveoc64/grocery-crud

tuareg
  • profile picture
  • Member

Posted 19 January 2012 - 15:56 PM

[quote name='web-johnny' timestamp='1326914255' post='300']

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

[/quote]

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!

tuareg
  • profile picture
  • Member

Posted 19 January 2012 - 15:57 PM

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

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 19 January 2012 - 17: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.

steveoc
  • profile picture
  • Member

Posted 19 January 2012 - 22: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 !

goFrendiAsgard
  • profile picture
  • Member

Posted 02 February 2012 - 13: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)

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 03 February 2012 - 18: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.

goFrendiAsgard
  • profile picture
  • Member

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.

steveoc
  • profile picture
  • Member

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

goFrendiAsgard
  • profile picture
  • Member

Posted 05 February 2012 - 02:28 AM

@steveoc Nice to hear from you ;)

vnt
  • profile picture
  • Member

Posted 22 February 2012 - 14:30 PM

the next version 1.2 will be very interesting!

naufal
  • profile picture
  • Member

Posted 11 March 2012 - 17: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.

mryasir
  • profile picture
  • Member

Posted 20 April 2012 - 13:23 PM

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

rjsig
  • profile picture
  • Member

Posted 24 April 2012 - 15: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.

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

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

Felipe Matos
  • profile picture
  • Member

Posted 26 February 2013 - 13: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.

davidoster
  • profile picture
  • Member

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.


php_lover
  • profile picture
  • Member

Posted 03 March 2013 - 09:02 AM

When MasterDetail feature available can we do something in this version