search widget

- displayBlock "list" aExtraParams exposition in js

SVN:b1162[5429]
This commit is contained in:
Bruno Da Silva
2018-03-14 16:35:35 +00:00
parent 42af530c63
commit ed02758940
3 changed files with 24 additions and 5 deletions

View File

@@ -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());");
}

View File

@@ -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(

View File

@@ -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;