In magento 2 I created a grid through UI components. It gets populated with my dataprovide class getData method:

public function getData()
    $questionSetId = $this->request->getParam('questionset_id');

    if (!$this->getCollection()->isLoaded()) {
        $this->getCollection()->addFieldToFilter('questionset_id', $questionSetId);

    return $this->getCollection()->toArray();;


I don't know if its normal that this function gets called twice, I have a param question_set in my url but the second time getData() gets called, $questionSetId becomes null which means that no data will be loaded because of the use of a filter.

What am I missing here?

PS. Magento 2.1.9

  • How did you get around this? – vitoriodachef May 7 '18 at 9:12
  • 1
    @vitoriodachef If recall correctly i used a data persistor for setting the data – Roy Jeurissen Jun 13 '18 at 8:19

Your Answer

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

Browse other questions tagged or ask your own question.