Jump to content

\IPS\Helpers\Table\Custom


newbie LAC
 Share

Go to solution Solved by Matt,

Recommended Posts

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;

 

Link to comment
Share on other sites

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

Edited by newbie LAC
Link to comment
Share on other sites

  • 5 months later...
 Share

  • Recently Browsing   0 members

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