Files
iTop/js/search/search_form_criteria_string.js
Guillaume Lajarige 601f18bbab Advanced search: WIP POC, integration with endpoint.
SVN:b1162[5419]
2018-03-13 16:10:17 +00:00

86 lines
1.9 KiB
JavaScript

//iTop Search form criteria string
;
$(function()
{
// the widget definition, where 'itop' is the namespace,
// 'search_form_criteria_string' the widget name
$.widget( 'itop.search_form_criteria_string', $.itop.search_form_criteria,
{
// default options
options:
{
// Overload default operator
'operator': 'contains',
// Available operators
'available_operators': {
'contains': {
'label': Dict.S('UI:Search:Criteria:Operator:String:Contains'),
'code': 'contains',
'rank': 5,
},
'=': null, // Remove this one from string widget.
},
},
// the constructor
_create: function()
{
var me = this;
this._super();
this.element.addClass('search_form_criteria_string');
},
// called when created, and later when changing options
_refresh: function()
{
},
// events bound via _bind are removed automatically
// revert other modifications here
_destroy: function()
{
this.element.removeClass('search_form_criteria_string');
this._super();
},
// _setOptions is called with a hash of all options that are changing
// always refresh when changing options
_setOptions: function()
{
this._superApply(arguments);
},
// _setOption is called for each individual option that is changing
_setOption: function( key, value )
{
this._super( key, value );
},
//------------------
// Inherited methods
//------------------
// DOM element helpers
// _prepareElement: function()
// {
// var me = this;
//
// this._super();
//
// // TODO: Refactor this after UI mockups
// var oInputElem = $('<input type="text" />');
// oInputElem.on('change', function(){
// var sValue = $(this).val();
//
// me.options.values = [{
// value: sValue,
// label: sValue,
// }];
// me._setTitle();
//
// me.handler.triggerHandler('itop.search.criteria.value_changed');
// })
// .appendTo(this.element.find('.sfc_form_group'));
// },
});
});