Jobs index grid doesnt paginate currently. Shows every record
This commit is contained in:
parent
952f419d26
commit
e812841dcb
|
|
@ -15,28 +15,19 @@ class JobsController extends AppController {
|
|||
);
|
||||
|
||||
function index() {
|
||||
$this->Job->recursive = 1;
|
||||
/* $this->Job->recursive = 1;
|
||||
$this->set('jobs', $this->paginate());
|
||||
$this->set('customers', $this->Job->Enquiry->Customer->find('list'));
|
||||
$this->set('currencies', $this->Job->Currency->find('list'));
|
||||
$this->set('currencies', $this->Job->Currency->find('list'));*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function index_grid() {
|
||||
|
||||
$jobs = $this->paginate();
|
||||
$this->layout = 'jqgrid';
|
||||
//$jobs = $this->paginate();
|
||||
|
||||
/*$jobs = $this->Job->find('all', array('recursive'=>0));
|
||||
|
||||
$this->set('jobs', $jobs);
|
||||
|
||||
$customers = $this->Job->Enquiry->Customer->find('list');
|
||||
$this->set('customers', $customers);
|
||||
$this->set('currencies', $this->Job->Currency->find('list'));*/
|
||||
//print_r($this->params);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -44,8 +35,33 @@ class JobsController extends AppController {
|
|||
function build_jobs_json() {
|
||||
|
||||
$this->layout = 'ajax';
|
||||
$jobs = $this->paginate();
|
||||
|
||||
//print_r($this->params);
|
||||
|
||||
|
||||
$sortCol = 'id'; //Default we Order by ID
|
||||
$sortDir = 'desc'; //Descending.
|
||||
|
||||
|
||||
|
||||
if(isset($this->params['url']['sidx'])) {
|
||||
$sortCol = $this->params['url']['sidx'];
|
||||
}
|
||||
else {
|
||||
$sortCol = 'Job.id';
|
||||
}
|
||||
|
||||
if(isset($this->params['url']['sord'])) {
|
||||
$sortDir = $this->params['url']['sord'];
|
||||
}
|
||||
else {
|
||||
$sortDir = 'desc';
|
||||
}
|
||||
|
||||
$jobPaginated = $this->paginate(); //Not used currently.
|
||||
|
||||
$jobs = $this->Job->find('all', array('recursive'=>1, 'order'=>array('Job.id'=>'desc')));
|
||||
//print_r($jobs);
|
||||
$this->set('jobs', $jobs);
|
||||
|
||||
$customers = $this->Job->Enquiry->Customer->find('list');
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
<? $countString = $paginator->counter(array('format' => '%page% %pages% %current% %count%'));
|
||||
<?
|
||||
|
||||
$countString = $paginator->counter(array('format' => '%page% %pages% %current% %count%'));
|
||||
|
||||
$numbers = explode(" ",$countString);
|
||||
|
||||
$page = $numbers[0];
|
||||
$totalPages = $numbers[1];
|
||||
$currentNoRecord = $numbers[2];
|
||||
|
||||
$totalNoRecords = $numbers[3];
|
||||
|
||||
|
||||
|
|
@ -12,6 +15,9 @@ $recordObj->total = $totalPages;
|
|||
$recordObj->page = $page;
|
||||
$recordObj->records = $totalNoRecords;
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<?
|
||||
|
|
@ -59,7 +65,7 @@ foreach($jobs as $job) {
|
|||
|
||||
// $job['Job']['id'],
|
||||
$job['Job']['created'],
|
||||
$job['Job']['title'],
|
||||
$html->link($job['Job']['title'], array('controller'=>'jobs','action'=>'view', $job['Job']['id'])),
|
||||
$html->link($customers[$job['Enquiry']['customer_id']], array('controller'=>'customers','action'=>'view', $job['Enquiry']['customer_id'])),
|
||||
$job['Job']['customer_order_number'],
|
||||
$job['Job']['supplier_reference'],
|
||||
|
|
|
|||
|
|
@ -1,5 +1,19 @@
|
|||
<? echo $javascript->link('job_grid'); ?>
|
||||
|
||||
<? /*
|
||||
echo $paginator->counter(array(
|
||||
'format' => __('Page %page% of %pages%, showing %current% Jobs out of %count% total, starting on record %start%, ending on %end%', true)
|
||||
));
|
||||
?>
|
||||
|
||||
<div class="paging">
|
||||
|
||||
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
|
||||
| <?php echo $paginator->numbers();?>
|
||||
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?>
|
||||
</div>
|
||||
|
||||
*/ ?>
|
||||
<table id="grid" style=""></table>
|
||||
|
||||
<div id="gridpager"></div>
|
||||
|
|
@ -37,7 +37,6 @@ $(function() {
|
|||
source: "/countries/completeCountry",
|
||||
minLength: 3,
|
||||
select: function(event, ui) {
|
||||
alert("You selected " + ui.item.value + " ID:"+ ui.item.id);
|
||||
$("#CustomerCountryId").val(ui.item.id);
|
||||
|
||||
if(ui.item.value == 'Australia') {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ jQuery(document).ready(function(){
|
|||
name:'customer',
|
||||
index:'customer',
|
||||
width:400,
|
||||
editable:false
|
||||
editable:false,
|
||||
sortable: false
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -281,9 +282,8 @@ jQuery(document).ready(function(){
|
|||
],
|
||||
|
||||
// viewrecords: true,
|
||||
sortname: 'id',
|
||||
sortorder: "asc",
|
||||
rowNum: 50,
|
||||
|
||||
rowNum: 500,
|
||||
height: '100%',
|
||||
caption:"Jobs",
|
||||
editurl:"/jobs/ajax_edit",
|
||||
|
|
|
|||
Loading…
Reference in a new issue