Master/details forms with Grocery CRUD
Posted 18 January 2012 - 13:14 PM
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!
Posted 18 January 2012 - 19:17 PM
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 19 January 2012 - 11:46 AM
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
Posted 19 January 2012 - 15:56 PM
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!
Posted 19 January 2012 - 15:57 PM
You are doing a great work!
I am going to test it as soon as I can!
Bye.
Posted 19 January 2012 - 17:24 PM
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 19 January 2012 - 22:05 PM
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 !
Posted 02 February 2012 - 13:00 PM
And John, do you plan to merge this to the main branch (just want to know)
Posted 03 February 2012 - 18:58 PM
@staveoc if you need any help just PM to me.
Posted 04 February 2012 - 08:22 AM
@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.
Posted 04 February 2012 - 12:55 PM
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
Posted 05 February 2012 - 02:28 AM
Posted 22 February 2012 - 14:30 PM
Posted 11 March 2012 - 17:24 PM
.
{"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.
Posted 20 April 2012 - 13:23 PM
Posted 24 April 2012 - 15:20 PM
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.
Posted 25 April 2012 - 07:04 AM
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 26 February 2013 - 13:29 PM
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.
Posted 03 March 2013 - 09:02 AM
When MasterDetail feature available can we do something in this version