Visualization pulgin, how to get all records from a list ?

fran59

New Member
Hello,

I'm a new user of fabrik.
I try to get to create my own visalization plugin.

In my function here, I want to get all records in the variable alldata,
in fact I get only the first 5 , 10 lines according the pagination.

How can I get by code alldatas ?

Here my function,

PHP:
private function getTableDataPays()
	{
  
		if (!isset($this->tableDataPays))
		{
	      $tmodels = array();
		  $params = $this->getParams();
		  $lid = $params->get('programme_pays_table');
	
		  $listModel = null;
		  $listModel = JModel::getInstance('List', 'FabrikFEModel');
		  $listModel->setId($lid);

	      $list = $listModel->getTable();
	      $form = $listModel->getForm();
	
	      $listModel->unsetPluginQueryWhere('programme');
	
	      $listModel->setLimits();
	      
	      $listModel->getPagination(0, 0, 0);
	      
	      $listModel->render();
	      $alldata = $listModel->getData();
	      $cals = $listModel->getCalculations();

	      echo 'RecordCount : ' . count($alldata) . '<br>' ;

		}
		return $alldata;
	}
 
Hmmm, I think the problem there may be that you aren't setting the limitstart and length request variables, before calling setLimits(). Try adding the two lines right before the setLimits:

PHP:
		JRequest::setVar('limit' . $lid, 0);
		JRequest::setVar('limitstart' . $lid, 0);
		$listModel->setLimits();
 
Can you try updating to latest github, and then change your code to this:

PHP:
        $listModel->setLimits(0, 0);

Let me know if that works. I've added optional arguments to setLimits() for overriding with, without having to fake it out by setting the query string options before calling setLimits(). But I haven't really tested it much yet.

-- hugh
 
Hello Cheesegrits,

I tested your change in list.php,

It has a bad effect on the adminstration in fabrik.
Yet if I click on "ViewData" on a list in the "Lists", I get the following error message "Erreur HTTP 500 (Internal Server Error)".

same behaviour in the frontend.

Fran59
 
Hmmm, that really should have nothing to do with the changes I made.

I'm not getting any errors.

Can you try updating from github again? Maybe there was an error elsewhere in the code which has since been fixed.

-- hugh
 
I think the problem was I did only the update of the file "list.php"
Yet I copy all of the file from github.

Then i tested this function,
PHP:
$listModel->setLimits(0, 0);
It doesn't work,
I get only the first 10 lines in my example.
 
Hello,

cheesegrits, could you please have look ?
It works with
PHP:
JRequest::setVar('limit' . $lid, 0);
JRequest::setVar('limitstart' . $lid, 0);
$listModel->setLimits();

But not with
PHP:
$listModel->setLimits(0, 0);
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top