Jump to content


CRUD in a view, with set_primary_key, no work

crud view set_primary_key edit add

  • Please log in to reply
7 replies to this topic

#1 jariberi

jariberi

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 15 May 2013 - 10:52 PM

Hello! Sorry for my english, i have a problem.

 

I have 2 tables:

 

entidades (cuit, denominacion, direccion)

detalle_clientes (idclientes, limite_credito)

 

and a view:

clientes defined as:

 

 

select entidades.cuit, detalle_clientes.idclientes, entidades.denominacion,entidades.direccion, detalle_clientes.limite_credito from entidades inner join detalle_clientes on entidades.cuit=detalle_clientes.entidades_cuit;
 
Show the data, the grid, but when i want add or edit, not work. No inform any error, just freeze.
 
Here is my code:
 
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('clientes');
$crud->set_subject('Clientes');
$crud->set_language('spanish');
$crud->set_primary_key('idclientes','clientes');
$crud->columns(
       'idclientes',
       'cuit',
       'denominacion',
       'direccion',
       'limite_credito'
       );


     $output = $crud->render();
$this->load->view('entidades/clientes',$output);

 

 

Can you help me please?

 

Thanks!!!!

 
 

 

 



#2 davidoster

davidoster

    Grocery CRUD Ninja

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

Posted 16 May 2013 - 05:29 AM

Hello and welcome!

 

This SQL "select entidades.cuit, detalle_clientes.idclientes, entidades.denominacion,entidades.direccion, detalle_clientes.limite_credito from entidades inner join detalle_clientes on entidades.cuit=detalle_clientes.entidades_cuit;", where is it in your code?


____________________________________________________________

 

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

____________________________________________________________

 

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


#3 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 16 May 2013 - 03:55 PM

my small daughter says in this case 'nu-nu-nu'. :)

#4 Sanjay Pant

Sanjay Pant

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 16 May 2013 - 04:03 PM

I faced a similar problem earlier and realised that grocery crud does not work with views. I created a custom model using the sql used in view along with other tables and was able to get the desired output.



#5 jariberi

jariberi

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 16 May 2013 - 05:32 PM

The SQL is how is defined the view in mysql, is not in the code.

#6 davidoster

davidoster

    Grocery CRUD Ninja

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

Posted 16 May 2013 - 10:07 PM

The SQL is how is defined the view in mysql, is not in the code.

 

Oh! I am sorry! It's a MySQL view! Allright!

Why do you need to use a view? Is there a specific reason?

 

 

 

I faced a similar problem earlier and realised that grocery crud does not work with views. I created a custom model using the sql used in view along with other tables and was able to get the desired output.

It's true what Sanjay says. GC doesn't work well with MySQL views. It was build for using views to be honest!

Try the custom model, it might give you the solution you need. If not come back here to try to find another solution.


____________________________________________________________

 

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

____________________________________________________________

 

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


#7 mnish

mnish

    Member

  • Members
  • PipPip
  • 23 posts
  • LocationIndia

Posted 31 August 2013 - 04:58 PM

GC not work with custom sql join.

set_relation show all rows from second table.



#8 davidoster

davidoster

    Grocery CRUD Ninja

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

Posted 01 September 2013 - 01:42 AM

GC not work with custom sql join.

set_relation show all rows from second table.

 

Please post your issue here.


____________________________________________________________

 

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

____________________________________________________________

 

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






Also tagged with one or more of these keywords: crud, view, set_primary_key, edit, add

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users