I have a many-many relationship in a page in a SS 3.1 installation and have verified that it works with GridField perfectly. I wanted to change it to TreeMultiselectField so that all Objects under a landing page show in the tree. It works perfectly for the first level, and even allows to select the second level and save. But when you try to edit it if the second level element is checked, as soon as the list is populated, you lose selection on second level. Attaching the screenshot for reference.
private static $many_many=array(
'Industries'=>'IndustryPage'
);
.
.
$IndustriesLandingPage = IndustriesLandingPage::get()->First();
$IndustriesField = new TreeMultiselectField('Industries', 'Select areas of Industries this article applies to', 'SiteTree');
if($IndustriesLandingPage){
$IndustriesField->setTreeBaseID($IndustriesLandingPage->ID);
}
$fields->addFieldToTab('Root.ServicesAndIndustries', $IndustriesField);