// I used a ListModel in the display() of a HtmlView.
$model = $this->getModel('mymodelname');
$model->setState('list.limit', '0');
// returns the default setting instead of the value I set on previous line
$listLimit = $model->getState('list.limit');
$listLimit
should be 0
$listLimit
is the default setting
Joomla 3.8.12 on XAMPP (Windows 10)
The same behavior is suspected in newer versions on any platform
I guess the setState()
method shouold call populateState()
if internal state is not set - just like in getState()
.
I don't want to overwrite the default setting by overwriting the model's populateState()
, because I needed all the items from the model in this view only.
Labels |
Added:
?
|
Does your issue still remain?
Yes. I did not copy the code, I typed it in here. My original code did not contain these typos. Sorry for that.
Joomla 3.8.12 on XAMPP
The current Joomla version is 3.9.2. You should update you're Joomla and test again.
I've updated to Joomla 3.9.2 but the problem is still there.
Sorry for the delay.
Status | New | ⇒ | Information Required |
@HLeithner can you please comment?
If the Model is new you have to first get the State and then you can change the state, don't ask me why thats Joomla behavior.
simple make $model->getState();
before you make the setState call
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-03-16 11:30:33 |
Closed_By | ⇒ | joomla-cms-bot |
Closed_By | joomla-cms-bot | ⇒ | franz-wohlkoenig |
Closed as Solution provided above. Please reopen if i misunderstood.
You have a syntax error (missing quote):
And you have to pass the property name (
list.limit
) togetState()
: