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.064 seconds

  I want to save the world...... let's cook a solution about it.
VeCrea (Forum)

Get Started