Posted July 28, 20195 yr Hello, $data = array(); foreach (range(1,100) as $r) { $data[] = array( 'field1' => 'value' . $r ); } $table = new \IPS\Helpers\Table\Custom( $data, \IPS\Http\Url::internal("app=app&module=module&controller=controller") ); $table->quickSearch = 'field1'; \IPS\Output::i()->output = (string) $table; Search by value11 This is also affect on built in functions E.g. SQL toolbox
July 30, 20195 yr On 7/29/2019 at 12:18 PM, bfarber said: Thanks, I've added an internal bug report to get this checked into. Potentially related to
October 4, 20195 yr Author Hello, On 7/29/2019 at 10:18 PM, bfarber said: Thanks, I've added an internal bug report to get this checked into. Your fix broke some my custom tables. I don't use quick search and pass to $dataSource X items returned for current page Could you change this? For example move $this->count = \count( $rows ); $this->pages = ceil( $this->count / $this->limit ); inside if ( $this->quickSearch !== NULL and \IPS\Request::i()->quicksearch ) { $quickSearchColumn = $this->quickSearch; $rows = array_filter( $rows, \is_callable( $this->quickSearch ) ? $this->quickSearch : function( $row ) use ( $quickSearchColumn ) { return mb_strpos( mb_strtolower( $row[ $quickSearchColumn ] ), mb_strtolower( trim( \IPS\Request::i()->quicksearch ) ) ) !== FALSE; } ); // HERE } Thanks
October 4, 20195 yr Can you please clarify how I can see this (new) concern in action? When I use the SQL toolbox as an example, pagination seems to work normally.
October 5, 20195 yr Author 12 hours ago, bfarber said: Can you please clarify how I can see this (new) concern in action? When I use the SQL toolbox as an example, pagination seems to work normally. 20 hours ago, newbie LAC said: Your fix broke some my custom tables. I found bug during development application Since you don't like custom code I ofund example (sql toolbox) in the Suite For this I couldn't find code in the Suite
October 7, 20195 yr Ok if you're not seeing an example in the Suite, can you at least outline/clarify what the new issue is that is occurring? Why does moving those lines up as you suggest resolve the problem? We may be able to test a quick contrived example that way.
October 8, 20195 yr Author 15 hours ago, bfarber said: Ok if you're not seeing an example in the Suite, can you at least outline/clarify what the new issue is that is occurring? Why does moving those lines up as you suggest resolve the problem? We may be able to test a quick contrived example that way. Example I use some API https://domain.tld/api/?k=val&limit=25 The limit is from 10 to 25. Default is 10 Output is total: 250 results: list of items I can't get more than 25 items. But I can use offset https://domain.tld/api/?k=val&limit=25&offset=25 The table $limit = 25; $page = (isset(\IPS\Request::i()->page) and (\intval(\IPS\Request::i()->page) > 0)) ? \IPS\Request::i()->page : 1; $offset = ($limit * ($page - 1)); $data = array( 'results' => array(), 'total' => 0, ); try { $data = \IPS\Http\Url::external('https://domain.tld/api') ->setQueryString( array( 'k' => 'val', 'limit' => 25, 'offset' => $offset, ) ) ->request() ->get() ->decodeJson(); } catch (\Exception $e) {} $table = new \IPS\Helpers\Table\Custom($data['results'], $url); $table->limit = $limit; $table->pages = ceil($data['total'] / $limit); 250/25 = 10 pages With your fix $this->count = \count( $rows ); $this->pages = ceil( $this->count / $this->limit ); $this->count = \count( $rows ); // 25 (I pass 25 items) $this->pages = ceil(25 / 25 ); // 1 page Since I don't use quick search move the code inside condition resolve my issue Edited October 8, 20195 yr by newbie LAC
October 17, 20195 yr The same issue here. The patch provided by @newbie LAC solves it for me. Edited October 17, 20195 yr by Sonya*
Archived
This topic is now archived and is closed to further replies.