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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Table Field


Go to End


2 Posts   1403 Views

Avatar
Dr0gaz

Community Member, 37 Posts

1 April 2011 at 4:51am

hi guys i've a table field inside my dataobject... but the table works badly.... when delete one record ... my dataobject show white... and when i add a record a ive a checkbox... this checkbox show enable but.. disable others chebox in table why?

<?php
// /mysite/code/Divisao.php
class Divisao extends DataObject {
static $db = array (
'Nome' => 'Varchar(255)'
);

static $has_one = array (
'ObraPage' => 'ObraPage'
);

static $has_many = array (
'Detalhes' => 'Detalhe'
);

public function getCMSFields_forPopup()
{
if( $this->ID == NULL ){
return new FieldSet(
new TextField('Nome','Assoalhada')
);
} else{

return new FieldSet(
new TextField('Nome','Assoalhada'),

new TableField(
//'Detalhes',
'Detalhes',
'Detalhe',
array('Nome' => 'Nome', 'Estado' => 'Estado'),
array('Nome' => 'TextField', "Estado" => "OptionsetField('Estado','Estado',singleton('Detalhe')->dbObject('Estado')->enumValues())" ),
"DivisaoID",$this->ID
//"DropdownField('Estado','Estado',singleton('Detalhe')->dbObject('Estado')->enumValues())"

....

<?php
class Detalhe extends DataObject {
static $db = array (
'Nome' => 'Varchar(255)',
"Estado" => "Enum('Caracteristica,Acabamento','Caracteristica')"
);

static $has_many = array (

);

static $has_one = array (
'Divisao' => 'Divisao'
);

}

Avatar
UncleCheese

Forum Moderator, 4102 Posts

7 April 2011 at 7:29am

Yeah, I don't think that's ever going to work. Way too many dependency conflicts.