I'm using php and Angular JS and this is my code :
<table class="table table-bordered">
<thead>
<tr>
<th><Bold>Participation fille-société</Bold></th>
<th><Bold>Secteur d'activité</Bold></th>
<th><Bold>Date d'acquisition</Bold></th>
<th><Bold>Prix d'acquisition</Bold></th>
<th><Bold>Tri actualisé</Bold></th>
<th><Bold>Type d'operation</Bold></th>
<th><Bold>Participations meres</Bold></th>
<th><Bold>Action<Bold></th>
</tr>
</thead>
</tbody>
<tr >
<td><Bold><a href="consultationPFS.php?id_participationfilleS={{ps.id_participationfilleS}}">{{ps.nomParticipationFilleS}}</Bold></td>
<td><Bold>{{ps.secteurActivite}}</Bold></td>
<td><Bold>{{ps.date_aquisition}}</Bold></td>
<td><Bold>{{ps.Prix_acquisition}}</Bold></td>
<td><Bold>{{ps.tri_actualise}}</Bold></td>
<td><Bold>{{ps.tri_actualise}}</Bold></td>
<td ng-repeat="ac in DataPmers"><Bold>{{ac.nom_participation}} {{ac.pourcentage}}%</Bold></td>
<td><a type="submit" class="edit-row" href="UpdatePFS.php?id_participationfilleS={{ps.id_participationfilleS}}" title="Modifier" ><i class="fa fa-pencil"></i></a> | <a type="submit" class="delet-row" title="Supprimer" ng-click="supp(ps)"><i class="fa fa-trash"</i></button></a> | <a type="submit" class="edit-row" href="EtatPFS.php?id_participationfilleS={{ps.id_participationfilleS}}" title="Modifier" ><i class="fa fa-pencil"></i></a></td>
</tr>
</tbody>
</table><div class="box-footer clearfix">
And the result like in the picture below :
As u can see in Participations meres it give me only one data and other line of data in other column
How can I get all data of participation mere in the same column ?
Would this work for you - new row of the table for each DataPmers?
<table class="table table-bordered">
<thead>
<tr>
<th><Bold>Participation fille-société</Bold></th>
<th><Bold>Secteur d'activité</Bold></th>
<th><Bold>Date d'acquisition</Bold></th>
<th><Bold>Prix d'acquisition</Bold></th>
<th><Bold>Tri actualisé</Bold></th>
<th><Bold>Type d'operation</Bold></th>
<th><Bold>Participations meres</Bold></th>
<th><Bold>Action<Bold></th>
</tr>
</thead>
</tbody>
<tr ng-repeat="ac in DataPmers">
<td><Bold><a href="consultationPFS.php?id_participationfilleS={{ps.id_participationfilleS}}">{{ps.nomParticipationFilleS}}</Bold></td>
<td><Bold>{{ps.secteurActivite}}</Bold></td>
<td><Bold>{{ps.date_aquisition}}</Bold></td>
<td><Bold>{{ps.Prix_acquisition}}</Bold></td>
<td><Bold>{{ps.tri_actualise}}</Bold></td>
<td><Bold>{{ps.tri_actualise}}</Bold></td>
<td><Bold>{{ac.nom_participation}} {{ac.pourcentage}}%</Bold></td>
<td><a type="submit" class="edit-row" href="UpdatePFS.php?id_participationfilleS={{ps.id_participationfilleS}}" title="Modifier" ><i class="fa fa-pencil"></i></a> | <a type="submit" class="delet-row" title="Supprimer" ng-click="supp(ps)"><i class="fa fa-trash"</i></button></a> | <a type="submit" class="edit-row" href="EtatPFS.php?id_participationfilleS={{ps.id_participationfilleS}}" title="Modifier" ><i class="fa fa-pencil"></i></a></td>
</tr>
</tbody>
</table>
Related
I have one table and in this table, I have two button Update and Disable I want to hide those buttons
I trying like this
<table id="example1" class="table table-bordered table-striped table-sm" style=" overflow: auto; ">
<tr>
<th>Dispatch Challan No</th>
<th>Date</th>
<th>From</th>
<?php
$hide = 'OFF';
if($hide == 'ON') { ?>
<th>Update</th>
<th>Delete</th>
<?php } ?>
</tr>
<?php foreach($dispatch as $dis){?>
<tr>
<td><?php echo $dis->disp_ch_no;?></td>
<td><?php echo date("d-m-Y", strtotime($dis->disp_ch_date));?></td>
<td><?php echo $dis->from_branch_name;?></td>
<td><a class="btn btn-success btn-sm" href="<?php echo base_url(); ?>booking/dispatch_challan/DispatchChallanController/updateDispatchChallanPage?disp_id=<?php echo $dis->disp_id; ?>"><i class="fa fa-pencil" > Update</i></a></td>
<td><a class="btn btn-danger btn-sm" onclick="delete_dispatch('<?php echo $dis->disp_id; ?>');" title="Click here to delete your Dispatch record"><i class="fa fa-trash" style="color: #fff;"> Disable </i> </a>
</td>
</tr>
<?php }?>
</table>
this is my table
How can I hide these buttons
Try this,
<?php
$thswitch = 'OFF';
if($thswitch == 'ON') { ?>
<th>Update</th>
<th>Delete</th>
<?php } ?>
whenever you want to show just $thswitch = 'ON'; it
You have to check the if () for each row as we did in th. Like:
<table id="example1" class="table table-bordered table-striped table-sm" style="overflow: auto;">
<tr>
<th>Dispatch Challan No</th>
<th>Date</th>
<th>From</th>
<?php $hide = 'OFF';
if ($hide == 'ON') { ?>
<th>Update</th>
<th>Delete</th>
<?php } ?>
</tr>
<?php foreach($dispatch as $dis) { ?>
<tr>
<td> <?php echo $dis->disp_ch_no;?> </td>
<td> <?php echo date("d-m-Y", strtotime($dis->disp_ch_date));?> </td>
<td> <?php echo $dis->from_branch_name;?> </td>
<?php if ($hide == 'ON') { ?>
<td>
<a class="btn btn-success btn-sm" href="<?php echo base_url(); ?>booking/dispatch_challan/DispatchChallanController/updateDispatchChallanPage?disp_id=<?php echo $dis->disp_id; ?>"><i class="fa fa-pencil" > Update</i></a>
</td>
<td>
<a class="btn btn-danger btn-sm" onclick="delete_dispatch('<?php echo $dis->disp_id; ?>');" title="Click here to delete your Dispatch record"><i class="fa fa-trash" style="color: #fff;"> Disable </i> </a>
</td>
<?php } ?>
</tr>
<?php } ?>
</table>
Or by using CSS you can hide this columns as:
Create a CSS class like:
.hidethisColumn { display: none !important; }
Use it in you table as:
<th class="<?=(($hide == 'ON')? 'hidethisColumn' : '')?>">Update</th>
<th class="<?=(($hide == 'ON')? 'hidethisColumn' : '')?>">Delete</th>
Similarly in rows inside foreach():
<td class="<?=(($hide == 'ON')? 'hidethisColumn' : '')?>">
<a class="btn btn-success btn-sm" href="<?php echo base_url(); ?>booking/dispatch_challan/DispatchChallanController/updateDispatchChallanPage?disp_id=<?php echo $dis->disp_id; ?>"><i class="fa fa-pencil" > Update</i></a>
</td>
I have a table of each request filed by the user with corresponding actions to it. When I click on the update button, it doesnt load the view after submitting it.
This is my html code:
<table id="dataTableRequestDrafts" class="table table-striped table-bordered data-table-drafts" style="width:100%">
<thead>
<tr>
<th style="display: none;">Request ID</th>
<th>Request Type</th>
<th>Date Requested</th>
<th>Date Last Updated</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach($param_drafts as $drafts){?>
<tr>
<td class="id" style="display: none;"><?php echo $drafts['idx']?></td>
<td class="type"><?php echo $drafts['request_type']?></td>
<td><?php echo $drafts['date_requested']?></td>
<td><?php echo $drafts['date_updated']?></td>
<td class="text-warning"><?php echo $drafts['status']?></td>
<td align="center">
<form action="<?php echo base_url('dashboard/staff/request/update_request_view'); ?>" method="post">
<input type="text" name="request_id" value="<?php echo $drafts['idx']?>" style="display: none;">
<button type="button" class="btn waves-effect waves-light btn-primary view-button"><i class="fa fa-eye"></i> View</button> <button type="submit" class="btn waves-effect waves-light btn-info update-button"><i class="fa fa-edit"></i> Update</button> <button type="button" class="btn waves-effect waves-light btn-danger delete-button" data-url="<?php echo base_url('dashboard/staff/request/delete');?>"><i class="fa fa-trash-o"></i> Delete</button>
</form>
</td>
</td>
</tr>
<?php } ?>
</tbody>
</table>
This is my function in the controller:
public function update_request_view()
{
$data = new stdClass;
$data->param_menu = 'request';
$idx = $this->input->post('request_id');
$type = $this->staffrequisition_model->getRequestType($idx);
$typeLower = strtolower($string = str_replace(' ', '', $type));
$commonContents = $this->staffrequisition_model->selectItem(array('idx'=> $idx));
$uncommonContents = json_decode($commonContents->contents);
$data->param_request = array_merge((array) $commonContents, (array) $uncommonContents);
$this->load->view('dashboard/staff/update_'.$typeLower.'_view', $data);
}
The view is seen in the response but it doesnt load the view. I was gonna use ajax but it would be tedious to load the data of the request in each input in the view and I want to return the whole html page not just a div.
Can you show the response here.
sometimes the response can't handle by browser. so it can't appear
I'm using bootstrap and I have used a table to echo users data by using PHP, the problem is that there's a lot of results, so I want to show pagination below that table, and I want to do this with jQuery if possible? If not I guess I will go for PHP.
How could I do it?
I have tried several plugins and different methods, but actually I'm a beginner and it didn't work smoothly for me.
One of the jQuery plugins I tried is simplePagination.js but nothing is working.
My code:
<table class="table table-striped">
<thead>
<tr>
<th width="30%">User Name</th>
<th width="35%">Email</th>
<th width="30%">Phone</th>
<th width="5%">Option</th>
</tr>
</thead>
<tbody>
<tr id="users">
<th><?php echo $row['mem_uname']; ?></th>
<td><?php echo $row['mem_email']; ?></td>
<td><?php echo $row['mem_phone']; ?></td>
<td>
<a class="btn btn-danger option"
href="home?p=Users&delete=<?php echo $row['mem_id'];?>">Delete</a>
</td>
</tr>
</tbody>
</table>
You could use dataTables jQuery plugin which:
Is bootstrap friendly
Includes pagination, you would only need to tweak it's length via jQuery.
See snippet below:
$('#myTable').dataTable({
"pageLength": 4
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.13/js/dataTables.bootstrap.min.js"></script>
<table id="myTable" class="table table-striped">
<thead>
<tr>
<th width="30%">User Name</th>
<th width="35%">Email</th>
<th width="30%">Phone</th>
<th width="5%">Option</th>
</tr>
</thead>
<tbody>
<tr id="users">
<th>TEST</th>
<td>TEST</td>
<td>TEST</td>
<td>
<a class="btn btn-danger option" href="home?p=Users&delete=<?php echo $row['mem_id'];?>">Delete</a>
</td>
</tr>
<tr id="users">
<th>TEST</th>
<td>TEST</td>
<td>TEST</td>
<td>
<a class="btn btn-danger option" href="home?p=Users&delete=<?php echo $row['mem_id'];?>">Delete</a>
</td>
</tr>
<tr id="users">
<th>TEST</th>
<td>TEST</td>
<td>TEST</td>
<td>
<a class="btn btn-danger option" href="home?p=Users&delete=<?php echo $row['mem_id'];?>">Delete</a>
</td>
</tr>
<tr id="users">
<th>TEST</th>
<td>TEST</td>
<td>TEST</td>
<td>
<a class="btn btn-danger option" href="home?p=Users&delete=<?php echo $row['mem_id'];?>">Delete</a>
</td>
</tr>
<tr id="users">
<th>TEST</th>
<td>TEST</td>
<td>TEST</td>
<td>
<a class="btn btn-danger option" href="home?p=Users&delete=<?php echo $row['mem_id'];?>">Delete</a>
</td>
</tr>
<tr id="users">
<th>TEST</th>
<td>TEST</td>
<td>TEST</td>
<td>
<a class="btn btn-danger option" href="home?p=Users&delete=<?php echo $row['mem_id'];?>">Delete</a>
</td>
</tr>
<tr id="users">
<th>TEST</th>
<td>TEST</td>
<td>TEST</td>
<td>
<a class="btn btn-danger option" href="home?p=Users&delete=<?php echo $row['mem_id'];?>">Delete</a>
</td>
</tr>
<tr id="users">
<th>TEST</th>
<td>TEST</td>
<td>TEST</td>
<td>
<a class="btn btn-danger option" href="home?p=Users&delete=<?php echo $row['mem_id'];?>">Delete</a>
</td>
</tr>
</tbody>
</table>
From Here I am doing like I fetch data from database and display in table format still it is working fine, after I click the division_edit() function I want pass the value (id),how can do this.
<table id="dataTable" class="table table-bordered table-hover">
<thead>
<tr>
<th>S.No</th>
<th>Division</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $sql=m ysql_query( "SELECT * FROM division WHERE status !='1'"); for($i=1;$row=m ysql_fetch_assoc($sql);$i++){ ?>
<tr role="row" class="odd">
<td>
<?php echo $i;?>
</td>
<td>
<?php echo $row[ 'division'];?>
</td>
<td><a class="btn btn-success btn-xs" href="state_edit.php?id=<?php echo base64_encode($row['id']);?>" onclick="division_edit()" id="division_edit"><i class="fa fa-pencil-square-o"></i> Edit</a>
<button class="btn btn-danger btn-xs" data-href="state_delete.php?id=<?php echo base64_encode($row['id']);?>"
data-toggle="modal" data-target="#confirm-delete"><i class="fa fa-trash"></i> Delete</button>
</td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<th>S.No</th>
<th>Division</th>
<th>Action</th>
</tr>
</tfoot>
</table>
May this help you:
<table id="dataTable" class="table table-bordered table-hover">
<thead>
<tr>
<th>S.No</th>
<th>Division</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $sql=m ysql_query( "SELECT * FROM division WHERE status !='1'"); for($i=1;$row=m ysql_fetch_assoc($sql);$i++){ ?>
<tr role="row" class="odd">
<td>
<?php echo $i;?>
</td>
<td>
<?php echo $row[ 'division'];?>
</td>
<td><a class="btn btn-success btn-xs" href="state_edit.php?id=<?php echo base64_encode($row['id']);?>" onclick="division_edit(<?php echo $row['id']; ?>)" id="division_edit"><i class="fa fa-pencil-square-o"></i> Edit</a>
<button class="btn btn-danger btn-xs" data-href="state_delete.php?id=<?php echo base64_encode($row['id']);?>"
data-toggle="modal" data-target="#confirm-delete"><i class="fa fa-trash"></i> Delete</button>
</td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<th>S.No</th>
<th>Division</th>
<th>Action</th>
</tr>
</tfoot>
</table>
Try this..
<a class="btn btn-success btn-xs" href="state_edit.php?id=<?php echo base64_encode($row['id']);?>" onclick="division_edit(<?php echo $row['id'] ?>)" id="division_edit"><i class="fa fa-pencil-square-o"></i> Edit</a>
I'm using SB Admin Bootstrap.
My table didn't functioning as it should be (should be user can search the data in table and data arranged well), but :
This is my php code:
<div class="box-content">
<?php
if ($result) {
?>
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<thead>
<tr>
<th class="text-left">User ID</th>
<th class="text-left">Username</th>
<th class="text-left">Password</th>
<th class="text-left">Full Name</th>
<th class="text-left">Task</th>
</tr>
</thead>
<?php
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '
<tbody>
<tr>
<td class="center">' . $row['userid'] . '</td>
<td class="center">' . $row['username'] . '</td>
<td class="center">' . $row['password'] . '</td>
<td class="center">' . $row['fullname'] . '</td>
<td class="center">
<a class="btn btn-success" href="#">
<i class="halflings-icon white zoom-in"></i>
</a>
<a class="btn btn-info" href="#">
<i class="halflings-icon white edit"></i>
</a>
<a class="btn btn-danger" href="#">
<i class="halflings-icon white trash"></i>
</a>
</td>
</tr>
</tbody>';
}}
?>
</table>
</div>
Answer moved from comment
You are repeating <tbody> element, so script are just taking first occurrence of this tag and executing some functions, leaving every further <tbody> intact.
Move out of loop, it must be unique in table.