mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
search widget
- displayBlock "list" aExtraParams exposition in js SVN:b1162[5429]
This commit is contained in:
@@ -284,17 +284,22 @@ class DisplayBlock
|
||||
}
|
||||
|
||||
|
||||
if ($this->m_sStyle != 'search') // Search form need to extract result list extra data, the simplest way is to expose this configuration
|
||||
if ($this->m_sStyle == 'list') // Search form need to extract result list extra data, the simplest way is to expose this configuration
|
||||
{
|
||||
|
||||
$listJsonExtraParams = json_encode(json_encode($aExtraParams));
|
||||
$oPage->add_ready_script("
|
||||
$('#$sId').data('sExtraParams', \"$sExtraParams\");
|
||||
$('#$sId').data('bAutoReload', \"$sExtraParams\");
|
||||
$('#$sId').data('sExtraParams', ".$listJsonExtraParams.");
|
||||
$('#$sId').data('bAutoReload', \"".(int) $bAutoReload."\");
|
||||
console.debug($('#$sId').data());
|
||||
console.debug($('#$sId'));
|
||||
console.debug('#$sId');
|
||||
|
||||
");
|
||||
|
||||
|
||||
|
||||
|
||||
// $oPage->add_ready_script("console.debug($('#Menu_UserRequest_OpenRequests').data());");
|
||||
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ try
|
||||
$oDisplayBlock = new DisplayBlock($oFilter, 'list', false);
|
||||
|
||||
$sListParams = stripslashes(utils::ReadParam('list_params', '{}', false, 'raw_data'));
|
||||
$aListParams = json_decode($sListParams, true);
|
||||
$aListParams = (array) json_decode($sListParams, true);
|
||||
|
||||
|
||||
$aPassFromExtraParamsToListParams = array(
|
||||
|
||||
@@ -146,7 +146,8 @@ class SearchForm
|
||||
}
|
||||
$aSearchParams = array(
|
||||
'criterion_outer_selector' => "#fs_{$sSearchFormId}_criterion_outer",
|
||||
'result_list_outer_selector' => "#{$aExtraParams['table_id']}",
|
||||
'result_list_outer_selector' => "#{$aExtraParams['table_id']}",
|
||||
'data_config_list_selector' => null, //this one will be set just bellow, it mean to tell the widget where to find the initial list configuration
|
||||
'endpoint' => utils::GetAbsoluteUrlAppRoot().'pages/ajax.searchform.php',
|
||||
'list_params' => $aListParams,
|
||||
'search' => array(
|
||||
@@ -156,6 +157,19 @@ class SearchForm
|
||||
),
|
||||
);
|
||||
|
||||
if (isset($aSearchParams['list_params']['table_inner_id']))
|
||||
{
|
||||
$aSearchParams['data_config_list_selector'] = '#'.$aSearchParams['list_params']['table_inner_id'];
|
||||
}
|
||||
elseif (isset($aSearchParams['list_params']['table_id']))
|
||||
{
|
||||
$aSearchParams['data_config_list_selector'] = '#'.$aSearchParams['list_params']['table_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$aSearchParams['data_config_list_selector'] = '#'.$aSearchParams['result_list_outer_selector'];
|
||||
}
|
||||
|
||||
$oPage->add_ready_script('$("#fs_'.$sSearchFormId.'").search_form_handler('.json_encode($aSearchParams).');');
|
||||
|
||||
return $sHtml;
|
||||
|
||||
Reference in New Issue
Block a user