newbie LAC Posted July 28, 2019 Posted July 28, 2019 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
bfarber Posted July 29, 2019 Posted July 29, 2019 Thanks, I've added an internal bug report to get this checked into.
MrFisc Posted July 30, 2019 Posted July 30, 2019 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
newbie LAC Posted October 4, 2019 Author Posted October 4, 2019 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
bfarber Posted October 4, 2019 Posted October 4, 2019 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.
newbie LAC Posted October 5, 2019 Author Posted October 5, 2019 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
bfarber Posted October 7, 2019 Posted October 7, 2019 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.
newbie LAC Posted October 8, 2019 Author Posted October 8, 2019 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
Sonya* Posted October 17, 2019 Posted October 17, 2019 The same issue here. The patch provided by @newbie LAC solves it for me.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.