Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

forking populateState does not work 14 Jun 2015 21:24 #13264

  • MorganL
  • MorganL's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
I though I was going mad, but been able to replicate this in several models now.

Basically I wanted to use a different version of

parent::populateState('a.ordering', 'asc');

to set the default filters in a view. i.e in this case

parent::populateState('a.creation_date', 'desc');

I have already FORK'ed the model for prepareQuery and that works fine.. however, any changes I was making to the FORK'ed populateState was not working.

I then altered the core populateState in the appropriate model and that worked.

So unless I am doing something extremely stupid, populateState cannot be forked in a model, even though everything else can
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla

Please Log in or Create an account to join the conversation.

forking populateState does not work 13 Jul 2015 09:17 #13332

I do not know what code you created, but if you use parent in your fork, maybe this is your problem?
www.j-cook.pro/index.php/f/forks

parent, self

The fork feature has a limitation with the parent and self keywords.
In facts, the parent of your forked class is the original one, not its real parent.
The self keyword call the original class, so in your fork it becomes parent.

Some trick functions like JView::_parentDisplay() permit to avoid this problem.

For example when you override a view file, instead of calling :

parent::display(); //Infinite loop
Replace by one of the following possibilities

$this->_parentDisplay();
self::_parentDisplay(); // Static call
return self::_parentDisplay(); //Static call with returning value
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

forking populateState does not work 24 Sep 2015 18:17 #13496

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I have fixed the function, so you can now achieve it.

When it receives ordering & direction from parent, it uses it in priority.

By the way, I also cleaned the item model which should not be concerned by this ordering & direction.
So I removed the parameters in the populateState() item model.

Hope it helps.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.083 seconds

Real time saver and great Component Builder tool ! I have been developing with J-Cook Pro Component Builder for several months now and can say with all honesty that this product/service is second to none. The product is feature rich and is being improved and added to all the time. Do yourself a favor if you need to build a Joomla! Component then you can do no wrong in trying the product. You will save on time and effort while being able to deliver your project on time. J-Cook pro does the hard work for you you then have the freedom to fully customise the end result for your own needs. 

One word: Awesome.
Edwardcox (JED)
         

Get Started