Jump to content

\IPS\Helpers\Table\SEARCH_NODE possible bug?


BomAle

Recommended Posts

Posted

I have this code

$table = new \IPS\Helpers\Table\Db( 'core_sys_lang_words', $baseUrl, $where );
$table->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core', 'admin'), 'table' );
$table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core', 'admin' ), 'rows' );
$table->advancedSearch = array(
		'word_app'		=> array( \IPS\Helpers\Table\SEARCH_NODE, array( 'class'=> 'IPS\Application', 'subnodes' => false,
		                                                                   'permissionCheck' => function( $app )
		                                                                   {
				                                                                   return $app->enabled OR $app->directory == 'nexus';
		                                                                   }, 'multiple' => TRUE )),
	);

And after submit the dialog/form when click on pagination the table don't load any rows the count is 0 (ajax), after some testing it seem because $where[] = array( \IPS\Db::i()->in( $k, $values ) ); add "1=0" into query.

I have edited \IPS\Helpers\Table\Db::getRows on "case SEARCH_NODE:"

FROM
foreach ( $v as $_v )
TO
foreach ( $v as $_k => $_v )

AND

FROM
$_v = $nodeClass::load( $_v );
TO
$_v = $nodeClass::load( $_v ? $_v : $_k );

Now it work, but have you same issue?

Posted

into admincp there is records module watch it: app=cms&module=databases&controller=records&do=manage

click on "cogs" icon

submit the form and there is not any results to show.

the zeroval is not assigned but a "0" is setted

&advanced_search_submitted=1&csrfKey=5..........ca45&content_db_table_category_id=0&content_db_table_record_comments=null

it must be
&advanced_search_submitted=1&csrfKey=5..........ca45&content_db_table_category_id=content_db_table_as_no_cat&content_db_table_record_comments=null

for this take a look into: \IPS\Helpers\Form\Node::getValue
/**
 * Get Value
 *
 * @return	string|int
 */
public function getValue()
{
	$zeroValName = "{$this->name}-zeroVal";
	if ( $this->options['zeroVal'] !== NULL and isset( \IPS\Request::i()->$zeroValName ) )
	{
		return 0;
	}
	else
	{
		return parent::getValue();
	}
}

it is not same class IPS\Application I have into my code

$table->advancedSearch = array(
	'word_app'		=> array(
		\IPS\Helpers\Table\SEARCH_NODE, 
		array(
			'class'=> 'IPS\Application',
			'subnodes' => false,
			'permissionCheck' => function( $app )
			{
				return $app->enabled OR $app->directory == 'nexus';
			},
			'multiple' => TRUE
		)
	)
);

... but is another similar issue

look into data-baseurl attribute into html table helper for my issue on pagination links

added video into first post (I suppose is issue into \IPS\Helpers\Form\Node::formatValue())

Posted

Yes, that's probably your best bet. I'm not really clear on what the issue is just from your description. We need more sort of "Go to this page, click this, and this happens but that should happen instead" type information.

Archived

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

  • Recently Browsing   0 members

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