[updated 24/11/2012] Dependent dropdown (library)
Posted 13 December 2012 - 21:04 PM
Posted 13 December 2012 - 21:07 PM
I'll have a time on the next week end. Can solve the problem.
[/quote]
Thank you!
Posted 14 December 2012 - 02:54 AM
code runs fine in save process, but an error in the editing process,
can you help me please ?
[/quote][quote name='victor' timestamp='1355428416' post='4704']
When did you download the latest version of grocery crud?
May be it your problem http://www.grocerycr...t__60#entry4441
[/quote]
This error is when I do an update on the grocery list
A Database Error Occurred
Error Number: 1146
Table 'grocerycrudzone_receive_stock' doesnt exist
Select * from ('zone_received_stock') where 'id'='2'
Filename: C:\xampp\htdocs\grocerycrud\system\database\DB_Driver.php
Line Number :: 330
Posted 14 December 2012 - 03:05 AM
This error is when I do an update on the grocery list
A Database Error Occurred
Error Number: 1146
Table 'grocerycrudzone_receive_stock' doesnt exist
Select * from ('zone_received_stock') where 'id'='2'
Filename: C:\xampp\htdocs\grocerycrud\system\database\DB_Driver.php
Line Number :: 330
[/quote]
I've put the fix that I was wrong to main table
Posted 16 December 2012 - 20:44 PM
Posted 16 December 2012 - 21:27 PM
When I start an Add
I get the first dropdown for country Active, so that I can select it, and the other two deactivated. Ok, so I select France and for the regions that come now I get this
"NetworkError: 404 Not Found - http://localhost/realestate/Atributos_Copia/atributos_codigo/get_items/id_region/64"
where 64 is the number that corresponds to France.
where is my error Viktor because I have really the same scheme than in your example, Countries, Regions and Cities
thank you a lot
Posted 16 December 2012 - 21:29 PM
Posted 16 December 2012 - 21:30 PM
Posted 16 December 2012 - 21:52 PM
show url to the controller and function
[/quote]
http://localhost/realestate/index.php/atributos_Copia/atributos_codigo
Posted 16 December 2012 - 21:54 PM
and show your code please
[/quote]
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Atributos_Copia extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->library('grocery_crud');
$this->load->library('image_moo');
$this->load->library('gc_dependent_select');
}
public function index()
{
;
}
public function atributos_codigo()
{
$crud = new grocery_CRUD();
$crud->set_subject('Atributos');
$crud->set_table('atributos');
$crud->where('Email', $this->session->userdata('username'));
$crud->set_relation('id_objeto','object','object_name');
$crud->set_relation('id_seller','seller','seller_type');
$crud->set_relation('id_situation_s','situation','type_situation');
$crud->set_relation('id_transaction','transaction','transaction_type');
$crud->set_relation('id_pais', 'paises', 'nombre_pais');
$crud->set_relation('id_region', 'regiones', 'nombre_region');
$crud->set_relation('id_town', 'localidades', 'nombre_localidad');
$fields = array(
// first field:
'id_pais' => array( // first dropdown name
'table_name' => 'paises', // table of country
'title' => 'nombre_pais', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'id_region' => array( // second dropdown name
'table_name' => 'regiones', // table of state
'title' => 'nombre_region', // state title
'id_field' => 'id_region', // table of state: primary key
'relate' => 'id_pais', // table of state: id_pais es la foreign key de paises
'data-placeholder' => 'select state' //dropdown's data-placeholder:
),
// third field. same settings
'id_town' => array( // third dropdown name
'table_name' => 'localidades',
'order_by'=>"nombre_localidad DESC", // string. It's an optional parameter.
'title' => 'nombre_localidad', // now you can use this format )))
'id_field' => 'id_localidad',
'relate' => 'id_region',
'data-placeholder' => 'select city'
)
);
$config = array(
'main_table' => 'atributos',
'main_table_primary' => 'id_atributo',
"url" => base_url() . __CLASS__ . '/' . __FUNCTION__ . '/'
);
$categories = new gc_dependent_select($crud, $fields, $config);
// the second method:
$js = $categories->get_js();
#+++++++++++++++ UPLOADING AND RESIZING PICS+++++++++++++++++
$crud->set_field_upload('thumb_a','assets/uploads/thumbs'); # $crud->set_field_upload('pic1','assets/uploads/pics'); # a
$crud->callback_after_upload(array($this,'resize')); #
$output = $crud->render();
$output->output.= $js;
$this->_example_output($output);
}
#+++++++++++++++++++RESIZING PICS ++++++++++++++++++++++++++++++++++++++++++
function resize($uploader_response,$field_info, $files_to_upload)
{
$thumb_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->name;
$file_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->name;
$this->image_moo->load($thumb_uploaded)->resize(160,120)->save($thumb_uploaded,true);
$this->image_moo->load($file_uploaded)->resize(600,400)->save($file_uploaded,true);
if($this->image_moo->error) {
print $this->image_moo->display_errors();
}
return true;
}
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function _example_output($output = null)
{
$this->load->view('our_template.php',$output);
}
}
Posted 16 December 2012 - 21:55 PM
"url" => base_url() .'index.php/'. __CLASS__ . '/' . __FUNCTION__ . '/'
Posted 16 December 2012 - 22:01 PM
THANK YOU A MILLION TIMES
GOD BLESS YOU
YOU ARE A LEGEND!
Thank you for your great intelligence and thank you for helping us so much!!
Posted 16 December 2012 - 22:03 PM
Posted 18 December 2012 - 03:02 AM
when I use the native grocery crud CRUD process went smoothly with your library, but just integration with CI Bonfire, dropdown relation can not run smoothly, it endlessly looping
Posted 18 December 2012 - 08:14 AM
Posted 18 December 2012 - 08:17 AM
I think there is a javascript scripts conflict or "first_url" is invalid. What error do you have?
[/quote]
loops that do not stop when I have a dropdown category
Posted 18 December 2012 - 08:18 AM
Posted 18 December 2012 - 08:37 AM
Show your url to function and show your first_url form config
[/quote]
this is url to call function research
<a href="<?php echo site_url(SITE_AREA.'/content/kms/research')?>">
Posted 18 December 2012 - 08:42 AM
Posted 18 December 2012 - 08:43 AM