1

I'm looking for a way to get the state/settings for the order_sales_view grid on a in a php class.

I want to load the grid and the filter state to use for selecting previous and next order according to the logged in user settings in the sales order grid.

By using \Magento\Ui\Api\BookmarkManagementInterface I can find the grid settings.

public function __construct(\Magento\Ui\Api\BookmarkManagementInterface $bookmarkManagement){
    $bookmark = $this->bookmarkManagement->loadByNamespace('sales_order_grid');
}

This does not load the filter settings. How can i load the filter settings?

0

Found the answer.

After running following code, $config will contain all i need.

public function __construct(\Magento\Ui\Api\BookmarkManagementInterface $bookmarkManagement){
    $bookmark = $this->bookmarkManagement->loadByNamespace('sales_order_grid');
    $config = [];
    foreach ($bookmarks->getItems() as $bookmark) {
        if ($bookmark->isCurrent()) {
            $config['activeIndex'] = $bookmark->getIdentifier();
        }

        $config = array_merge_recursive($config, $bookmark->getConfig());
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.