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

Input type of sourcefilter/setSourceFilter


Go to End


1221 Views

Avatar
Martijn

Community Member, 271 Posts

30 August 2010 at 11:27pm

Hi,

I want to use DataObjectManager as a ResultsTable in ModelAdmin.

This works fine, until I close the popup, then the all the items returns in the TableList without applying my ModelAdmin searchcriteria.

I tried to use $tf->setSoureFilter($filter); , but I need to convert the ResultAssembly from ModelAdmin to a format that DOM can pick up after the refresh.

In the method loadSourceFilter() there is this part:

if(!empty($this->filter)) {
$break = strpos($this->filter, "_");
$field = substr($this->filter, 0, $break);
$value = substr($this->filter, $break+1, strlen($this->filter) - strlen($field));
$filter_string = $field . "='$value'";
}

But I don't quite understand what the input needs to be.

The format of the querystring from ModelAdmin is like this:

ResultsForm?Title=test&ResultAssembly%5BTitle%5D=Title

What's the correct input for DataObjectManager->setSourceFilter($filter); so I can convert the ModelAdmin ResultsAssembly to a DataObjectManager format?

Thanks in advance.