Hi!
I'm using the stable version of builder (Stable 2.7) ... but after the new site upgrade, I'm having strange issues with "mycontext.modal" case in the prepareQuery model's method.
Before the updgrade, i could write a fork with the following instructions:
switch($this->getState('context', 'all'))
{
case 'contatore.default':
...
break;
case 'contatore.modal':
//BASE FIELDS
$this->addSelect( 'a.matricola');
$this->setState('list.limit', null);
break;
case 'all':
...
break;
}
and the "modal" context was set by default, when populating data for a list in an item view. So it was sufficient define a FK model like this:
$model_contatore_divisionale = CkJModel::getInstance('Contatore', 'LettintemporipartiModel');
$model_contatore_divisionale->addGroupOrder("a.matricola");
$lists['fk']['contatore_divisionale'] = $model_contatore_divisionale->getItems();
Now, the "modal" context is not set by default, so I had to specify it manually (as following):
$model_contatore_divisionale = CkJModel::getInstance('Contatore', 'LettintemporipartiModel');
$model_contatore_divisionale->setState('context', 'contatore.modal');
$model_contatore_divisionale->addGroupOrder("a.matricola");
$lists['fk']['contatore_divisionale'] = $model_contatore_divisionale->getItems();
Nevertheless, "$this->setState('list.limit', null)" seems to do anything. I tried to use JLog functions to test del "modal" case and it works, but no limit is set!
So I tried to use the populateState method as morganleecy did, but no luck!!
public function populateState($ordering = null, $direction = null)
{
// Initialise variables.
$app = JFactory::getApplication();
$session = JFactory::getSession();
$acl = LettintemporipartiHelper::getActions();
parent::populateState('a.matricola', 'asc');
$this->setState('list.limit', 0); //THIS WORKS FOR ALL, OBVIOUSLY
if($this->context == "contatore.modal")
{
JLog::add("WHY NOT?", 'jerror');
$this->setState('list.limit', 0); //THIS DOESN'T WORK :((( WHY NOT?
}
}
The second setStaste doesn't work, and I really don't figure how...because the error "WHY NOT?" is printed...
Where i miss?