-1

So i have an standard gridview created by gii, it is connected to a mysql database that already have some records, it works perfect but i need that when the page is loaded, no data should be displayed on the view, it only should be displayed after a search is done on any of the fields.

How can i setup a gridview that on load no data is displayed?

Thanks in advance

Slava Vedenin
  • 49,939
  • 13
  • 36
  • 57
hackbro
  • 1
  • 2

1 Answers1

0

You could do something like this (or a variation with several search parameters) in your ModelSearch.php

if($this->your_search_attribute == '') $query->andFilterWhere(['id' => 0]);

Do not know if there's a easier more yii-like way..

Jørgen
  • 2,827
  • 5
  • 26
  • 45