Welcome, Guest
Username: Password: Remember me

TOPIC: (HIGH) Ajax select boxes changes not applying

(HIGH) Ajax select boxes changes not applying 01 Jul 2015 14:43 #13305

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 16
I have altered the following code in my view.php.html file to filter the contents of a select box

From
$model_second_line_grp = CkJModel::getInstance('Oncallareas', 'RtcalloutModel');
        $model_second_line_grp->addGroupOrder("a.area");

        $lists['fk']['second_line_grp'] = $model_second_line_grp->getItems();

to
$model_second_line_grp = CkJModel::getInstance('Oncallareas', 'RtcalloutModel');
        $model_second_line_grp->addWhere("a.second_line=1");
        $model_second_line_grp->addGroupOrder("a.area");

        $lists['fk']['second_line_grp'] = $model_second_line_grp->getItems();

I have tried this change in both a FORK and in the core file. However the SELECT box is not applying the WHERE statement

When I look at DEBUG mode, I see that the query has been created (and checks out in MYSQL with the correctly filtered results) but there is ALSO a query for selecting every single record. It is this unfiltered list that appears to be applying to my dropdown i.e query 15 and not 17 in the debugging

Here are the queries

15 -
SELECT a.id,a.created_by,a.published,a.*

  FROM p17oj_rtcallout_oncallparents AS a

  WHERE (a.created_by = 40 OR 1) 
  AND (a.published = 0 OR a.published = 1 OR a.published IS NULL)

  ORDER BY a.name,a.ordering asc

17 -
SELECT a.id,a.created_by,a.published,a.*

  FROM p17oj_rtcallout_oncallareas AS a

  WHERE (a.created_by = 40 OR 1) 
  AND (a.published = 0 OR a.published = 1 OR a.published IS NULL) 
  AND a.second_line=1

  ORDER BY a.area,a.ordering asc

Looking in the view php file, I can see that the results are being called for second_line_grp, but wondering if the ajax is just pulling in the default list
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.
Time to create page: 0.075 seconds

Get Started