⚠ 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

Multiple Grids in one page.



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

Posted 16 June 2012 - 15:34 PM

A very interesting fork of grocery CRUD that with this extension you can easily have multiple grids at your project is the forked project https://github.com/Xrymz/grocery-crud commited by Дмитрий Рыбников also known with the username [member='Xrymz']

The installation it's easy , you just download the latest version from https://github.com/X.../zipball/master and you just copy the files at your Codeigniter project (the same thing that you do with the grocery CRUD installation). When this is done you can easily have a result that will look like this: [attachment=200:multi-grid.png]

An example of how using it you can see it below:


function multi()
{
$GCM = new Grocery_crud_multi();

$GCM->grid_add(1);

$GCM->grids[1]->set_table('film');
$GCM->grids[1]->set_subject('film');

$GCM->grid_add(2);

$GCM->grids[2]->set_table('products');
$GCM->grids[2]->set_subject('products');

$GCM->grid_add(3);

$GCM->grids[3]->set_table('customers');
$GCM->grids[3]->set_subject('customers');

$output = $GCM->render();

$this->_example_output_multi($output);
}

function _example_output_multi($output = null)
{
if(is_array($output['output']))
$output['output'] = implode(' ',$output['output']);

$this->load->view('example.php',$output);
}

rteranm
  • profile picture
  • Member

Posted 10 July 2012 - 00:53 AM

sorry to bother you, the code is great, I have a problem I DOWNLOAD these files but the styles do not load and I have other errors.

Thanks


A PHP Error was encountered
Severity:Notice
Message : Undefined variable : unic_id
Filename : view/list_template.php
Line Number : 33

djbeemer
  • profile picture
  • Member

Posted 13 July 2012 - 12:43 PM

This works well. I have found a problem with it:

If I have 2 grids, and both have relations set, the relations from the first grid get applied to the second grid. and the query then crashes.

eg:

$details = new Grocery_crud_multi();

$details->grid_add(1);

$details->grids[1]->set_table('projects_events');
$details->grids[1]->set_subject('Project Event');
$details->grids[1]->set_relation('event_type_id','types_events','event_type_name');

$details->grid_add(2);

$details->grids[2]->set_table('projects_appliances');
$details->grids[2]->set_subject('Project Appliance');
$details->grids[2]->set_relation('room_id','types_rooms','room_name');
$details->grids[2]->set_relation('type_id','types_appliances','appliance_name');
$details->grids[2]->set_relation('make_id','types_makes','make_name');

$output = $details->render();


[b] A Database Error Occurred[/b]

Error Number: 1054
Unknown column 'j5e891baf.event_type_name' in 'field list'
SELECT `projects_appliances`.*, j5e891baf.event_type_name AS s5e891baf, j8273f993.room_name AS s8273f993, j94757cae.appliance_name AS s94757cae, j14dd5396.make_name AS s14dd5396 FROM (`projects_appliances`) LEFT JOIN `types_rooms` as j8273f993 ON `j8273f993`.`room_id` = `projects_appliances`.`room_id` LEFT JOIN `types_appliances` as j94757cae ON `j94757cae`.`type_id` = `projects_appliances`.`type_id` LEFT JOIN `types_makes` as j14dd5396 ON `j14dd5396`.`makes_id` = `projects_appliances`.`make_id` LIMIT 25

Filename: /home/app/public_html/models/grocery_crud_model.php

Ive done some debugging in the model file, and found that the $this->relation array in the get_list function (when rendering the second grid) has the relation from the first grid included.

I was wondering if you could have a look at this??

The same happens when not using the multi plugin if i define the 2 tables manually.. and then render() twice.

Xrymz
  • profile picture
  • Member

Posted 18 July 2012 - 11:50 AM

I'm sorry for not having replied, I now have a large workload at work (try a few days to see the error which occurred in you, and try to help solve them.

rteranm
  • profile picture
  • Member

Posted 19 July 2012 - 03:15 AM

[quote name='djbeemer' timestamp='1342183403' post='2691']
This works well. I have found a problem with it:

If I have 2 grids, and both have relations set, the relations from the first grid get applied to the second grid. and the query then crashes.

eg:

$details = new Grocery_crud_multi();

$details->grid_add(1);

$details->grids[1]->set_table('projects_events');
$details->grids[1]->set_subject('Project Event');
$details->grids[1]->set_relation('event_type_id','types_events','event_type_name');

$details->grid_add(2);

$details->grids[2]->set_table('projects_appliances');
$details->grids[2]->set_subject('Project Appliance');
$details->grids[2]->set_relation('room_id','types_rooms','room_name');
$details->grids[2]->set_relation('type_id','types_appliances','appliance_name');
$details->grids[2]->set_relation('make_id','types_makes','make_name');

$output = $details->render();


[b] A Database Error Occurred[/b]

Error Number: 1054
Unknown column 'j5e891baf.event_type_name' in 'field list'
SELECT `projects_appliances`.*, j5e891baf.event_type_name AS s5e891baf, j8273f993.room_name AS s8273f993, j94757cae.appliance_name AS s94757cae, j14dd5396.make_name AS s14dd5396 FROM (`projects_appliances`) LEFT JOIN `types_rooms` as j8273f993 ON `j8273f993`.`room_id` = `projects_appliances`.`room_id` LEFT JOIN `types_appliances` as j94757cae ON `j94757cae`.`type_id` = `projects_appliances`.`type_id` LEFT JOIN `types_makes` as j14dd5396 ON `j14dd5396`.`makes_id` = `projects_appliances`.`make_id` LIMIT 25

Filename: /home/app/public_html/models/grocery_crud_model.php

Ive done some debugging in the model file, and found that the $this->relation array in the get_list function (when rendering the second grid) has the relation from the first grid included.

I was wondering if you could have a look at this??

The same happens when not using the multi plugin if i define the 2 tables manually.. and then render() twice.
[/quote]



[b]is true when relationships are blocked, not how to fix[/b].

[b]when you add or edit out the message in both tables[/b]

Mkendi
  • profile picture
  • Member

Posted 25 July 2012 - 07:39 AM

@web-johnny
Thank you for your amazing work.
Concerning this topic: may I assume, that this extention will part of the next offical release?

Thanks again
Mehmet
Istanbul / Turkey

Xrymz
  • profile picture
  • Member

Posted 20 August 2012 - 11:25 AM

Hi all! I'm sorry that I was gone, there were family problems, 29 of discharged from the service and refurbished extension, remove all the bugs and to make working with the latest version grocerycrud)
Sorry for bad English)) thanks google translate)

goFrendiAsgard
  • profile picture
  • Member

Posted 22 August 2012 - 08:28 AM

Wow, such a great work.... :)

casachit
  • profile picture
  • Member

Posted 23 August 2012 - 07:03 AM

lots of bugs needed to be fix... won't work on file upload... :( I keep on getting following error


[b] A PHP Error was encountered[/b]
[color=#000000][font=serif][size=1]
Severity: Notice[/size][/font][/color][color=#000000][font=serif][size=1]
Message: Undefined index: message_promt_delete_file[/size][/font][/color][color=#000000][font=serif][size=1]
Filename: libraries/grocery_crud.php[/size][/font][/color][color=#000000][font=serif][size=1]
Line Number: 3105[/size][/font][/color]

noskov.biz
  • profile picture
  • Member

Posted 23 August 2012 - 11:44 AM

Hi, casachit
A few months ago there was a small typo in the language files, look at this commit when it was fixed. Probably you have different parts with different bug fixes...

casachit
  • profile picture
  • Member

Posted 29 August 2012 - 16:59 PM

[quote name='noskov.biz' timestamp='1345722255' post='3089']
Hi, casachit
A few months ago there was a small typo in the language files, look at this commit when it was fixed. Probably you have different parts with different bug fixes...
[/quote]

thanks noskov.biz, but i still have problem with search ..its not working and refresh icon keeps on looping..

casachit
  • profile picture
  • Member

Posted 31 August 2012 - 05:53 AM

Like I said refresh icon keeps on looping and search option won't work.... multi data grid... Please help needed as soon as possible...

noskov.biz
  • profile picture
  • Member

Posted 31 August 2012 - 11:20 AM

Hi, casachit, unfortunatelly I didn't try multiple grids extention, so I couldn't tell you where the problem is exectly. Try to find what causes that error. Look at your firebug for the server response: what happens when you try to delete the uploaded file. I suppose, that it also can be some small typo somewhere at the code, that prevent passing to the page the message about deleting. If is it possible at the multiple grids, try and play just with 1 (!) grid - have you got that error without multi functionallity?

Well, I hope that it will give you the idea, but as I said that is only the shots in the dark, cause I didn't used that extention.

casachit
  • profile picture
  • Member

Posted 01 September 2012 - 07:04 AM

thanks noskov.biz, for your suggestion. But firebug didn't show any error... But I did find something in code..


$ci = &get_instance();
$seg = $ci->uri->segments;
$f = $ci->uri->segment(count($seg)-1);
$fv = $ci->uri->segment(count($seg));


In the grocery_crud_multi.php library, the above code shows that it is dependent on uri. If my url is much lengthier or shorter as a whole.. not as Xyrmz has when he created this library, then it will give error...

As a whole I would like to say its great extension but not feasible enough... But I did solve problem on the basis of my url... thanks to noskov.biz for your suggestion and Xyrmz for your effort to bring this up

arif rh
  • profile picture
  • Member

Posted 15 September 2012 - 07:49 AM

HI, casachit, do you use this Xrymz's extension just by copying grocery_crud_multi.php, without grocery_crud.php? If you do, (because maybe you have installed latest version of grocery CRUD), so you need to edit some lines in your grocery_crud.php file (related to unic_id variable) to make it works fine.

Djoudi
  • profile picture
  • Member

Posted 28 September 2012 - 13:01 PM

me tow the same prb
<div class="flexigrid" id="grid_<div style=" border:1px="" solid="" #990000;padding-left:20px;margin:0="" 0="" 10px="" 0;"="">
[b] A PHP Error was encountered[/b]

Severity: Notice
Message: Undefined variable: unic_id
Filename: views/list_template.php
Line Number: 33

tlc033
  • profile picture
  • Member

Posted 16 December 2012 - 01:47 AM

Hi. What about implementation like this http://carbogrid.com/index.php/sample/multiple ???

php_lover
  • profile picture
  • Member

Posted 12 March 2013 - 06:02 AM

It gives Fatal Error.Please help


victor
  • profile picture
  • Member

Posted 12 March 2013 - 09:22 AM

did you put the file of this plugin in the library directory?

php_lover
  • profile picture
  • Member

Posted 12 March 2013 - 10:23 AM

Yes Victor i put the file in library