Hi everyone,
I use codeigniter since 1 years to develop small project for my company and since 3 month i use render() function to call view from my controllers.
Everythings working well but I have a strange reaction when I use it with a form in a table
Here is my controller function :
PHP Code:
public function index()
{
$result_transporteur=$this->Suivi_Logistique_Model->select_all_transporteur();
foreach ($result_transporteur->result() as $row)
{
$data_table['select_transporteur_build'][]=(array(
'transporteurId' => $row->transporteurId,
'transporteurNom'=>$row->transporteurNom,
'selected'=>'',
));
}
$this->data['select_transporteur'] = $this->parser->parse('logistique/select_transporteur', $data_table, true);
$result=$this->Suivi_Logistique_Model->select_all_transport_bis();
if($result->num_rows()>0)
{
foreach ($result->result() as $row)
{
$data_table['table_data_build'][] =(array(
'id_transport'=>$row->transportId,
'fa_num'=>$row->affaireFaNum,
'nom_transporteur'=>$row->transporteurNom,
'date_demande'=>$row->transportDateDemande,
));
//Actualise les valeurs finale de chaque FA
}
}
else
{
/*$data_table['table_data_build'][] =(array(
'id_transport'=>'',
'fa_num'=>'',
'nom_transporteur'=>'',
'date_demande'=>'',
));*/
}
$this->data['table_data'] = $this->parser->parse('logistique/table_liste', $data_table, true);
$this->data['transporteur']='';
$this->data['title'] = "";
$this->data['pagetitle'] = "Suivi Logistique";
$this->data['welcome_message'] = "Bienvenue sur le suivi Logistique";
$this->data['pagebody'] = "logistique/suivi_logistique";
$this->data['maintitle'] = "Suivi Logistique";
$this->render();
}
In my principal view I have this code :
Code:
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>Liste des Bon de Transport</h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover dataTables-example" >
<thead>
<tr>
<th>Id</th>
<th>Transporteur</th>
<th>Date de demande</th>
<th>FA</th>
<th></th>
</tr>
</thead>
<tbody>
{table_data}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
And to show the result of my table I use this view
PHP Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* views/template.php
*
* Template for the menu Sidebar
*
*/
?>
{table_data_build}
<tr class="gradeX">
<td>{id_transport}</td>
<td>{nom_transporteur}</td>
<td>{date_demande}</td>
<td>{fa_num}</td>
<td>
<?php
echo validation_errors();
$attributes = array ('class'=>'form');
echo form_open('logistique/Suivi_Logistique/edit_transport',$attributes);
?>
<div class="form-group">
<div class="input-group">
<input type="hidden" name="id_transport" value="{id_transport}" class="form-control" >
</div>
</div>
<div class="form-group">
<button class="btn btn-primary dim" type="submit"><i class="fa fa-pencil"></i></button>
</div>
</form>
</td>
</tr>
{/table_data_build}
The problem is that in the first line of my table, the submit button not work (and only on the first line). All the other work correctly.
If anyone have a solution or an idea