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() {
|
function index() {
|
||||||
$this->Job->recursive = 1;
|
/* $this->Job->recursive = 1;
|
||||||
$this->set('jobs', $this->paginate());
|
$this->set('jobs', $this->paginate());
|
||||||
$this->set('customers', $this->Job->Enquiry->Customer->find('list'));
|
$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() {
|
function index_grid() {
|
||||||
|
$jobs = $this->paginate();
|
||||||
$this->layout = 'jqgrid';
|
$this->layout = 'jqgrid';
|
||||||
//$jobs = $this->paginate();
|
|
||||||
|
|
||||||
/*$jobs = $this->Job->find('all', array('recursive'=>0));
|
//print_r($this->params);
|
||||||
|
|
||||||
$this->set('jobs', $jobs);
|
|
||||||
|
|
||||||
$customers = $this->Job->Enquiry->Customer->find('list');
|
|
||||||
$this->set('customers', $customers);
|
|
||||||
$this->set('currencies', $this->Job->Currency->find('list'));*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,8 +35,33 @@ class JobsController extends AppController {
|
||||||
function build_jobs_json() {
|
function build_jobs_json() {
|
||||||
|
|
||||||
$this->layout = 'ajax';
|
$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);
|
$this->set('jobs', $jobs);
|
||||||
|
|
||||||
$customers = $this->Job->Enquiry->Customer->find('list');
|
$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);
|
$numbers = explode(" ",$countString);
|
||||||
|
|
||||||
$page = $numbers[0];
|
$page = $numbers[0];
|
||||||
$totalPages = $numbers[1];
|
$totalPages = $numbers[1];
|
||||||
$currentNoRecord = $numbers[2];
|
$currentNoRecord = $numbers[2];
|
||||||
|
|
||||||
$totalNoRecords = $numbers[3];
|
$totalNoRecords = $numbers[3];
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -12,6 +15,9 @@ $recordObj->total = $totalPages;
|
||||||
$recordObj->page = $page;
|
$recordObj->page = $page;
|
||||||
$recordObj->records = $totalNoRecords;
|
$recordObj->records = $totalNoRecords;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
|
|
@ -59,7 +65,7 @@ foreach($jobs as $job) {
|
||||||
|
|
||||||
// $job['Job']['id'],
|
// $job['Job']['id'],
|
||||||
$job['Job']['created'],
|
$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'])),
|
$html->link($customers[$job['Enquiry']['customer_id']], array('controller'=>'customers','action'=>'view', $job['Enquiry']['customer_id'])),
|
||||||
$job['Job']['customer_order_number'],
|
$job['Job']['customer_order_number'],
|
||||||
$job['Job']['supplier_reference'],
|
$job['Job']['supplier_reference'],
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,19 @@
|
||||||
<? echo $javascript->link('job_grid'); ?>
|
<? 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>
|
<table id="grid" style=""></table>
|
||||||
|
|
||||||
<div id="gridpager"></div>
|
<div id="gridpager"></div>
|
||||||
|
|
@ -37,7 +37,6 @@ $(function() {
|
||||||
source: "/countries/completeCountry",
|
source: "/countries/completeCountry",
|
||||||
minLength: 3,
|
minLength: 3,
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
alert("You selected " + ui.item.value + " ID:"+ ui.item.id);
|
|
||||||
$("#CustomerCountryId").val(ui.item.id);
|
$("#CustomerCountryId").val(ui.item.id);
|
||||||
|
|
||||||
if(ui.item.value == 'Australia') {
|
if(ui.item.value == 'Australia') {
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@ jQuery(document).ready(function(){
|
||||||
name:'customer',
|
name:'customer',
|
||||||
index:'customer',
|
index:'customer',
|
||||||
width:400,
|
width:400,
|
||||||
editable:false
|
editable:false,
|
||||||
|
sortable: false
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -281,9 +282,8 @@ jQuery(document).ready(function(){
|
||||||
],
|
],
|
||||||
|
|
||||||
// viewrecords: true,
|
// viewrecords: true,
|
||||||
sortname: 'id',
|
|
||||||
sortorder: "asc",
|
rowNum: 500,
|
||||||
rowNum: 50,
|
|
||||||
height: '100%',
|
height: '100%',
|
||||||
caption:"Jobs",
|
caption:"Jobs",
|
||||||
editurl:"/jobs/ajax_edit",
|
editurl:"/jobs/ajax_edit",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue