loading Fabrik instance on external class --> dropdown not rendered ?

lcollong

FabriKant d'applications web
Hi,

My app has a class to manipulate mySQL table outside regular forms (computations/updates/crons).
For pdf rendering, I need to load data "as Fabrik" in order to get rendered values. Thus the method I wrote :
PHP:
    public function loadFabrikRow($rowid, $listid = 0){
        $rowid = intval($rowid);
        $listid = intval($listid);
       
        if ($rowid < 1 ) {
            $this->JLog('loadFabrikRow - rowid invalide : '.$rowid, JLog::ERROR, 'Synapse');           
            return false;
        }
       
        if ($listid < 1) $listid = intval($this->fabrikListId);
        if ($listid < 1) {
            $this->JLog('loadFabrikRow - listid invalide : '.$listid, JLog::ERROR, 'Synapse');           
            return false;
        }
        $formModel = JModelLegacy::getInstance('Form', 'FabrikFEModel');
        $formModel->setId($listid);   
        $listModel = $formModel->getlistModel();       
        $row = $listModel->getRow($rowid, true, true);
        $this->fabrikData = is_object($row) ? FArrayHelper::fromObject($row, true) : $row;
        // echo "<pre>";print_r($row);echo "</pre>";
        return $this->fabrikData;
    }

Almost everything is rendered as if it was displayed in a form/details view (fabrikData contains an array with both raw values and rendered ones). Except a very basic dropdown. Both regular and raw value contain the same data. The raw one indeed. Can't get the corresponding label.

Did I forget something ?

Thanks
 
Is your element set to show in list view (resp. to "always render" in element settings)?
 
Well done :)
Marking it as "always render" does the job. Thanks.
However I'd expect to get the equivalent of the form load data ?....
 
Hmm, don't know.
Did you try without ACL restrictions?
Is it with all dbjoins or only this special one?
 
DBjoins elts are rendering ok. This one is a regular dropdown with nothing special except ACL. I'll try without ACL but I can't leave it. Since it works with "always render", I'll stop here. Thanks for your "clear vision" :)
 
Yes the "always render" does not modify the form/details view nor its behavior. The list view still works and my script is now loading the right things ! :)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top