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

TOPIC:

Weird behaviour of Jmodel 29 Apr 2013 07:49 #7100

Hello,
here some weird behaviour I found. I don't know if it's my coding mistake, but I didn't make big changes on the jmodel.item / jmodel.list jcook classes. by the way....

component details:
- few tables and views with several ajax filters.
- some table has fields with the same name

scenario:
on an item form view, I have some ajax filters but the data is not retrieved correctly.

Bug:
the data is not retrived correctly because the STATE "filter.FIELDNAME" (the same used on both tables) remains persistent between different models. (I know it's weird)

quick and dirty workaround (before a definitive solution):
simply clear the STATE "filter.FIELDNAME" before to call $model->getItem() or $model->getItems()

example:
$model = JModel::getInstance('items', 'ComponentModel');

// I remove all the filters variables for this model
$filter_vars = $model->get('filter_vars');
foreach($filter_vars as $f_varName => $type){
	$model->setState('filter.'.$f_varName, null);
}

$items = $model->getItems();

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

Last edit: by Tomaselli.

Weird behaviour of Jmodel 11 Aug 2013 15:01 #10740

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
This is fixed since 2.5.
Closed ticket.
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.079 seconds

The j-cook project is one of the best of its kind and it is nice that we all try to contribute in little ways to make life easy for each other.

vlemos (Forum)  

Get Started