'Lease.number', 'formatter' => 'id'); $cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'shortname', 'align' => 'center'); $cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname'); $cols['Rent'] = array('index' => 'Lease.rent', 'formatter' => 'currency'); $cols['Deposit'] = array('index' => 'Lease.deposit', 'formatter' => 'currency'); $cols['Signed'] = array('index' => 'Lease.lease_date', 'formatter' => 'date'); $cols['Move-In'] = array('index' => 'Lease.movein_date', 'formatter' => 'date'); $cols['Move-Out'] = array('index' => 'Lease.moveout_date', 'formatter' => 'date'); $cols['Closed'] = array('index' => 'Lease.close_date', 'formatter' => 'date'); $cols['Charge-Thru'] = array('index' => 'Lease.charge_through_date', 'formatter' => 'date'); $cols['Paid-Thru'] = array('index' => 'Lease.paid_through_date', 'formatter' => 'date'); $cols['Status'] = array('index' => 'status', 'formatter' => 'longenum'); $cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency'); $cols['Comment'] = array('index' => 'Lease.comment', 'formatter' => 'comment'); if (!empty($this->params['action'])) { if ($this->params['action'] === 'closed') $grid->invalidFields(array('Charge-Thru', 'Paid-Thru', 'Status')); elseif ($this->params['action'] === 'active') $grid->invalidFields(array('Closed')); elseif ($this->params['action'] === 'delinquent') $grid->invalidFields(array('Closed')); } // Render the grid $grid ->columns($cols) ->sortField('Lease') ->defaultFields(array('Lease')) ->searchFields(array('Customer', 'Unit')) ->render($this, isset($config) ? $config : null, array_diff(array_keys($cols), array('Signed', 'Charge-Thru', 'Status', 'Comment')));