Permalink
Browse files

improve how grid's link work, now relies on template

  • Loading branch information...
1 parent 72763b9 commit d050b624eb22da017c3d6e39d7c072a7352b28b5 @romaninsh romaninsh committed Apr 26, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/Grid/Basic.php
View
@@ -372,10 +372,17 @@ function format_order($field, $idfield='id'){
);
$this->current_row[$field]=$this->record_order->getCell($this->current_row['id']);
}
+ function init_link($field){
+ $this->setTemplate('<a href="<?$_link?>"><?$'.$field.'?></a>');
+ }
function format_link($field){
+ $this->current_row['_link']=$this->api->getDestinationURL('./details',array('id'=>$this->current_row['id']));
+ return $this->format_template($field);
+ /*
$this->current_row[$field]='<a href="'.$this->api->getDestinationURL($field,
array('id'=>$this->current_row['id'])).'">'.
$this->columns[$field]['descr'].'</a>';
+ */
}
function _performDelete($id){
$this->dq->where($this->dq->args['table'].'.id',$id)->do_delete();
@@ -853,6 +860,7 @@ function setFormatter($field,$formatter){
}
$this->columns[$field]['type']=$formatter;
if(method_exists($this,$m='init_'.$formatter))$this->$m($field);
+ $this->last_column=$field;
return $this;
}
}

0 comments on commit d050b62

Please sign in to comment.