Advanced search: WIP POC, better criteria widget instanciation.

SVN:b1162[5406]
This commit is contained in:
Guillaume Lajarige
2018-03-09 16:38:30 +00:00
parent b8aed0f004
commit 8cf4bc58a7

View File

@@ -254,7 +254,8 @@ $(function()
if(sType !== null)
{
var sWidgetClass = 'search_form_criteria' + '_' + sType;
// Retrieve widget class
var sWidgetName = this._getCriteriaWidgetNameFromType(sType);
// Add some informations from the field
if(this._hasFieldDefinition(sRef))
@@ -270,7 +271,7 @@ $(function()
.appendTo(this.elements.active_criterion);
// Instanciate widget
$.itop[sWidgetClass](oData, oCriteriaElem);
$.itop[sWidgetName](oData, oCriteriaElem);
}
else
{
@@ -300,6 +301,11 @@ $(function()
return sType;
},
// - Find a criteria's widget name from a criteria's type
_getCriteriaWidgetNameFromType: function(sType)
{
return 'search_form_criteria' + '_' + (($.itop['search_form_criteria_'+sType] !== undefined) ? sType : 'raw');
},
// Criteria handlers
_onCriteriaValueChanged: function(oData)
{
@@ -335,7 +341,7 @@ $(function()
'base_oql': this.options.search.base_oql,
'criterion': this.options.search.criterion,
}),
'list_params': this.options.list_params,
'list_params': JSON.stringify(this.options.list_params),
};
// Show loader