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

TOPIC:

Get state of a filter 15 Sep 2016 12:54 #14537

  • MorganL
  • MorganL's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
I should be able to do this, but lack of sleep is taking its toll

I have a field on a grid view that i ONLY want to show if someone is looking at grid with a filter_published = 2 (ie looking at archived records)

I though the filters were passed silently through POST but I suspect i need to use a STATE call

So in essence (making this stuff up) something like
<?php if(getState::(filter.published) == 2) { ?>
<td>STUFF YOU CAN SEE IF ARCHIVED</td>
<?php }; ?>
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.

Get state of a filter 15 Sep 2016 18:46 #14539

In a grid view you can do:
<?php if ($this->state->get('filter.published',0) == 2 ) : ?>
<td>STUFF YOU CAN SEE IF ARCHIVED</td>
<?php }; ?>

I have used it (also for hiding/showing columns)

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

Last edit: by Romkabouter.

Get state of a filter 15 Sep 2016 21:13 #14540

  • MorganL
  • MorganL's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
SO CLOSE!!!

Thanks as always
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.

Get state of a filter 16 Sep 2016 10:32 #14541

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
$model->getState('filter.xxxx')

EDIT : Better to use $model, because you can have various models instanced.
Instead, $this->state is only based on the page default model. (works also)
Coding is now a piece of cake
The following user(s) said Thank You: organicwebs

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

Last edit: by admin.

Get state of a filter 16 Sep 2016 10:40 #14542

Good addition, I was assuming the page default model was needed :)

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

Get state of a filter 16 Sep 2016 10:42 #14543

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Also $this->state works only in the view, instead the $model is cross application.
Always be careful with states that you are under the same context.

The states vars are a 2 dimentional matrix :
Unlimited states vars X unlimited contexts
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.099 seconds

I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started