⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. Very soon this forum will be read-only and archived. ⚠


Member Since 03 May 2017
Offline Last Active Jan 08 2021 11:13 AM

Posts I've Made

In Topic: Flexigrid - autorefresh

08 June 2017 - 09:19 AM

Solved, thank you anyway, it was a problem with route...

In Topic: Flexigrid - autorefresh

08 June 2017 - 07:36 AM

Hi! i am trying this too but it isn't working when i add something. 

I have two tabs opened on browser and when i add something in one table, the other table is not refreshing.

What am i doing wrong?


My controller:


   $jsfile = base_url('index.php/assets/bootstrap/js/refresh.js');

My js file content:

var interval = null;

window.onload = function() {
interval = setInterval(callFunc, 5000); 

function callFunc() {

In Topic: Generate eroor in callback_before_insert and show error message on add page

25 May 2017 - 06:00 PM

Hi! I have silimar problem with this but i have a query that limits number of rows and i don't know how to make this work.


This is my model function:

 public function get_duplicaterow() {
        $query = $this->db->query('SELECT * FROM intervaloshorarios INNER JOIN citas '
                . 'ON intervaloshorarios.idIntervaloHorario = citas.idIntervaloHorario '
                . 'GROUP BY citas.cita, intervaloshorarios.idIntervaloHorario '
                . 'HAVING COUNT(*) >= 2');

        return $query->result();

In the main controller function:

 $crud->set_rules('intervaloHorario', 'Franja Horaria', '_callback_doublerow_check');

In the controller:

  public function doublerow_check() {
I got this work whith duplicate rows and it don't let me add (fine at this point), but when i add non-existent row, it's not letting me add. What should i do? please help.



In Topic: pre-filling fields

20 May 2017 - 11:27 AM

Hello again! I have a new question wich is related with prefilling. Let's say i want to prefill a field wich is not passing id with callback column, for example, in my previous question i am getting the id of cita with callback column and autofilling a field in another table. But this table is composed with set relation betweent both tables (intervalos and citas). So, i spent three days and i'm unable to get the id of intervalohorario, for example, the intervalo (De 7:00 a 8:30) in order to hide its id in the other table too, like cita. How can i do that?



I have been trying hard this way but it doesn't work. Is there any efficient way?


Model function

public function get_idintervalo($idCitas) {

$query = $this->db->query('select intervaloshorarios.idIntervaloHorario '
. 'from intervaloshorarios left join citas '
. 'on intervaloshorarios.idIntervaloHorario=citas.idCitas '
. 'where citas.idCitas = '.$idCitas.' ;');

return $query ->result();

Controller (not full version)

public function entregas_lista($idCitas) {

//Calling model function
$query = $this->Intervalos_Model->get_idintervalo($idCitas);

$crud->where('entregas.idCitas =', $idCitas); 

if ($crud->getState() == "add") {
//This works
$crud->change_field_type('idCitas', 'hidden', $idCitas);

//Trying to pass idINtervaloHorario
$crud->change_field_type('idIntervaloHorario', 'hidden', $query);

In Topic: pre-filling fields

17 May 2017 - 07:20 AM

Well, thats because you have a relation on idCita. You should do relation only when you need it. I mean, yo should do relation on "idCita" when $crud->getState() != "add". While you have a relation on a field, you can't hide it.


Thank you very much! i didn't know that. I'm assuming it will work without a relation (normal field).