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

TOPIC:

Filter list by first filter value - by default 22 Jun 2012 13:18 #2616

Hi again,

I have a filter called 'fund_entry_state' which is using a lookup table (see my previous thread).

How can I make it so that the list view, by default, is filtered by one of these values as apposed to none?

Best regards,
K...

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

Re: Filter list by first filter value - by default 25 Jun 2012 09:22 #2637

OK, I realise I cannot set this from the J-Cook UI so I'll have to manually set my desired filter option as the default! Unless of course I am mistaken, please tell me if I am.

Thanks,
K...

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

Re: Filter list by first filter value - by default 25 Jun 2012 09:42 #2640

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Yes, Cook cannot define default filter values.

Some hardcode is needed in the populateState() function of your concerned model.
Coding is now a piece of cake

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

Re: Filter list by first filter value - by default 25 Jun 2012 14:19 #2655

Thanks Admin, don't suppose you have an example of making such a change do you? ;-)

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

Re: Filter list by first filter value - by default 02 Nov 2012 15:15 #4941

I too would also like to know the process to have a list view filtered by default. I have a rental properties table and don't really want the "Rented" properties to show. In backend the "status" is a required data field.

Any help would be appreciated. B)

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

Re: Filter list by first filter value - by default 02 Nov 2012 15:44 #4942

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
You'd need to use the populateState() function of your concerned model.

So, if your field is status, you need to filter by status...

Look at the filter by published (you'll find this in your model):
//Only show the published items
		if (!$acl->get('core.admin') && !$acl->get('core.edit.state'))
			$this->setState('filter.published', 1);

Hope it helps,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The following user(s) said Thank You: admin

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

Re: Filter list by first filter value - by default 02 Nov 2012 17:34 #4950

Yea that's a little over my head. More designer, less coder.

Don't really understand this...
Look at the filter by published (you'll find this in your model):

OK I think your referring to - root > components > mycomponent > models > mycomponent.php correct??

I see query statements in this php file. Could I simply change the SELECT * ?

Had another thought cross my feeble mind. Could I simply create a "Publish/Unpublish" selector in the Joomla backend? How hard is that? I'm sure outside of Cook.

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

Re: Filter list by first filter value - by default 02 Nov 2012 17:46 #4951

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
You could just just change the query but you need: ROOT/administrator/components/com_yourcomponentname/models/modelname.php

Check here: www.j-cook.pro/forum/9-coding-inside-you...tering-in-items#4500 for which query to add a case statement to.

Publishing is simple (inside cook)... Once you have a published field on your table (using wizards > publishing) you can simply add a filter (combo type) to the filters part of your admin list (grid view) then drag your field to the filter. There is a slight bug with this at the moment though if I remember correctly... Maybe not the way to go for you ATM.

___________________

Brainwave... What kind of field are you using for status? An enum field? or is it a foreign key?

You can filter on those in the grid view easily as described above for filtering published... Except, there is no bug there, it is working perfectly.

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

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

Re: Filter list by first filter value - by default 02 Nov 2012 18:03 #4954

Wow! Had no idea what the Wizards were. Thought maybe they were little scripts that helped you build. There was a published wizard. Simple as pie.

Wish there was more Docs about features. Or more in depth videos.

Thanks so much got it working perfect.

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

Last edit: by SproutCreatives.

Re: Filter list by first filter value - by default 02 Nov 2012 18:12 #4956

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
No probs...

I'd really recommend creating a couple of simple dummy projects to test how all of the features work before getting in to building anything too serious. It'll really help you to design your component.

Glad it helped!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

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

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

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started