Closed DrMartinGonzo closed 7 years ago
hey @DrMartinGonzo, di you have an example when this was a problem? Am trying to reproduce the error...
Sorry, here's a minimal version of the code for a DataObject where I had the problem. I just tested it, both instances of ColorField will update at the same time. Silverstripe version is 3.5.0
public function getCMSFields() {
$tabset = new Tabset(
'Root',
new Tab(
'TK',
ColorField::create('BgColor', 'Couleur de fond', null, array('opacity' => false)),
ColorField::create('TKBgColor', 'Couleur derrière le TK', null, array('opacity' => true))
)
);
$fields = FieldList::create(
$tabset
);
return $fields;
}
@DrMartinGonzo I cannot reproduce the error. I have 4 colorField on the same page and they all work fine and independently.
Could another module cause the error?
It seems "something" adds 'field' as an extra class in TabSet.ss
And thus var $parent = this.parents('.field');
also returns the whole tab.
I will investigate. Will come back with any results.
What is your Silverstripe version ?
I just tried it on 3.2.1, and I'm not seeing the problem.
Here's why :
Tabset.php on line 111 calls $this->extraClass()
on CompositeField class.
In 3.2.1, there's only function extraClasses
so nothing happens.
In 3.5.0, function extraClass
exists in CompositeField and this is the one that adds the field
class to the TabSet.
I don't know if it's intended behavior or not. Sorry for any bad english and lack of programming knowledge. I hope my explanation is clear enough.
I guess the selector could be more specific and parents
might not be the best choice. I'll merge this asap...
Merged here ecba6241721281f299444af99acc78daf638dd72
Colorfields used to be updated all at once