Jump to content

\IPS\Helpers\Table\Custom


newbie LAC

Recommended Posts

Posted

Hello,

How long will you have to cut the functionality?

Advanced search removed

Pagination... I need passed all rows to get real count pages. What do you'll get if count( $this->dataSource ) will be too much. "Fatal error: Allowed memory size of"

	public function getRows( $advancedSearchValues )
	{
		/* Sort out paging */
		$this->count = count( $this->dataSource );
		$this->pages = ceil( $this->count / $this->limit );

Earlier I can set

$table->pages = $pages;
$table->count = $count;

 

Posted
2 hours ago, Mark said:

I don't understand the question. 

t

4.0 I can create the table 

$limit 	= 20;
$page 	= (isset( \IPS\Request::i()->page ) and (intval( \IPS\Request::i()->page ) > 0)) ? \IPS\Request::i()->page : 1;
$start 	= ( $limit * ( $page - 1 ) );
$data = \IPS\Db::i()->select( '*', 'test_table', NULL, NULL, array( $start, $limit ), NULL, NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );

$table = new \IPS\Helpers\Table\Custom( iterator_to_array($data), \IPS\Http\Url::internal( 'some_url' ) );
$table->count = $count = $data->count( TRUE );
$table->pages = ceil( $count / $limit );

Result

4.0.thumb.png.9e053352f0f0a433f2bb25f0d4

4.1 Table looks like 

4.1.png.e1856fcc39976dc4d07c72535e34ca21

without pagination

$table->count and $table->pages overridden 

	public function getRows( $advancedSearchValues )
	{
		/* Sort out paging */
		$this->count = count( $this->dataSource );
		$this->pages = ceil( $this->count / $this->limit );

On 4.1 if I'll want create the same table I need provide all rows

$data = \IPS\Db::i()->select( '*', 'test_table' );
$table = new \IPS\Helpers\Table\Custom( iterator_to_array($data), \IPS\Http\Url::internal( 'some_url' ) );

Try it :)

Every time you remove a functional. Allow us set table properties

  • 5 months later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...