Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Filters in complexTableField (Solved)

Go to End

2 Posts   1004 Views


Community Member, 14 Posts

2 August 2011 at 6:17am

Hi, I'm new Siverstripe, and I have some doubts about the management of complextablefield.

I'm trying to add a filter, but I am unable to make it work ...

The result I want is that only appear in the CMS data for each project, rather than data from across the table.

I tried with a filter inside complexTablefield, and I've tried to create a record with the ID of the project within the rows and then create a filter based on this information, but I am unable to work.

My code:

class arqnProyecto extends Page {

static $many_many = array(
'datosProyecto' => 'arqnDatos'

getCMSFields function () {
$ fields = parent:: getCMSFields ();

$ table = new ComplexTableField (
$ this,
array (
'Details' => 'Details'
'Location' => 'Location',
'Thumb' => 'Image'
), 'GetCMSfields_forPopup'
"arqnDatos = '$ this -> ID'" / / FILTER, BUT NO WORKS
/ / null,
/ / null,
"arqnDatos.Proyecto", $ this-> ID / / SAVE ID FROM PROJECT BUT ALSO NO WORKS :(

Any help is good.

Thank you very much!



Community Member, 14 Posts

2 August 2011 at 4:06pm

Hello again, finally I find the answer:


class arqnProyecto extends Page {

static $many_many = array(
'datosProyecto' => 'arqnDatos'

function getCMSFields(){

$fields = parent::getCMSFields();

$tabla = new ComplexTableField(
'Detalles' => 'Detalles',
'Localizacion' => 'Localizacion',
'Thumb' => 'Imagen'
"`proyectoID` = '{$this->ID}'" // FILTER


return $fields;
class arqnProyecto_Controller extends Page_Controller {}

Where proyectoID comes from:


class arqnDatos extends DataObject {

// Crea un a tabla con tres columnas
static $db = array(
// 'Proyecto' => 'Text',
// 'Proyecto' => 'Int' ,
'Detalles' => 'Text',
'Localizacion' => 'Text',


static $has_one = array(
'imagenesProyecto' =>'Image',
'proyecto' => 'arqnProyecto'