Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Pass ID for expanders in table_id in addition to id

Currently the page inside expander gets ID of the row user
has clicked on through $_GET['id']. With this fix user also
can get id through $_GET['thetable_id']. The table is determined
properly from attached model, associtated dq table if grid
is static - page name. Finally it can be specified
manually too.
  • Loading branch information...
commit 6788f40c1fd8fb6d38df79c709c3f7990fffe11c 1 parent a29ef4c
@romaninsh romaninsh authored
Showing with 25 additions and 1 deletion.
  1. +25 −1 lib/Grid.php
View
26 lib/Grid.php
@@ -265,7 +265,10 @@ function format_expander($field, $column){
array('expander'=>$field,
'cut_page'=>1,
'expanded'=>$this->name,
- 'id'=>$this->current_row[$column['idfield']?$column['idfield']:'id']
+
+ // TODO: id is obsolete
+ 'id'=>$this->current_row[$column['idfield']?$column['idfield']:'id'],
+ $this->columns[$field]['refid'].'_id'=>$this->current_row[$column['idfield']?$column['idfield']:'id']
)
).'"
>'.$this->current_row[$field].'</button>';
@@ -274,6 +277,27 @@ function init_expander_widget($field){
return $this->init_expander($field);
}
function init_expander($field){
+
+ if(!isset($this->columns[$field]['refid'])){
+ // TODO: test
+
+ $refid=$this->getController();
+ if($refid)$refid=$refid->getModel();
+ if($refid)$refid=$refid->entity_code;
+ if($refid){
+ $this->columns[$field]['refid']=$refid;
+ }else{
+
+ if($this->dq)
+ $refid=$this->dq->args['table'];
+
+ if(!$refid)$refid=preg_replace('/.*_/','',$this->api->page);
+
+ $this->columns[$field]['refid']=$refid;
+ }
+ }
+
+
$class=$this->name.'_'.$field.'_expander';
$this->js(true)->_selector('.'.$class)->_load('ui.atk4_expander')->atk4_expander();
}
Please sign in to comment.
Something went wrong with that request. Please try again.