|
|
|
|
@ -996,6 +996,8 @@ if (EXPO.searchBlock){ |
|
|
|
|
var itFakeCheckbox = common.closest(it, fakeCheckboxClass); |
|
|
|
|
common.addClass(itFakeCheckbox, activeClass); |
|
|
|
|
it.checked = true; |
|
|
|
|
common.addClass(DOMParentItem,activeClass); |
|
|
|
|
common.removeClass(DOMSublist,'hidden'); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
unSelectItem = function (it) { |
|
|
|
|
@ -1358,9 +1360,16 @@ if (EXPO.searchBlock){ |
|
|
|
|
*/ |
|
|
|
|
_renderNested: function (dataObj, handler, template, item) { |
|
|
|
|
var self = this, |
|
|
|
|
Uri = Json2URI(dataObj); |
|
|
|
|
dna.load(template, (self.opt.ajaxUrl + Uri),{callback:handler,container:self.curDNA[template][item]}); |
|
|
|
|
Uri = Json2URI(dataObj), |
|
|
|
|
ajaxHandler = function (data) { |
|
|
|
|
if(data.length){ |
|
|
|
|
dna.load(template, (self.opt.ajaxUrl + Uri),{callback: function () { |
|
|
|
|
handler(data.length); |
|
|
|
|
},container:self.curDNA[template][item]}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
self._getAjax(dataObj, ajaxHandler); |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* check particular checkbox input |
|
|
|
|
@ -1384,7 +1393,7 @@ if (EXPO.searchBlock){ |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* select particular item and render its tag and check checkbox |
|
|
|
|
* @param {Object} item |
|
|
|
|
* @param {Object} item ({id:3,name:'area'}) |
|
|
|
|
* @public |
|
|
|
|
*/ |
|
|
|
|
selectTag:function (item) { |
|
|
|
|
@ -1546,50 +1555,21 @@ if (EXPO.searchBlock){ |
|
|
|
|
var self = this, dataObj, text , form = self.$inputFilter.attr('data-form'),index, |
|
|
|
|
$completeWrap = $('#'+self.opt.autoCompleteId), |
|
|
|
|
firstComplete = true, |
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @param event - Jquery event object |
|
|
|
|
* @param ui - JqueryUI selected item object. ({item: {Objectid: -2090174,label: "Бангалор",name: "ci"text: "Бангалор",value: -2090174}}) |
|
|
|
|
*/ |
|
|
|
|
selectTag = function (event, ui) { |
|
|
|
|
//check of repeating execution
|
|
|
|
|
var firstTime = true; |
|
|
|
|
for (var prop in self.curDNA) { |
|
|
|
|
for (var prop2 in self.curDNA[prop]) { |
|
|
|
|
if (prop2 == ui.item.value){ |
|
|
|
|
if($('#id_'+ui.item.value+':checked').length){ |
|
|
|
|
firstTime = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if($('#id_'+ui.item.value+':checked').length){ |
|
|
|
|
firstTime = false; |
|
|
|
|
} |
|
|
|
|
// ban of repeating execution
|
|
|
|
|
if (firstTime) { // konec
|
|
|
|
|
var $checkbox = $('#id_' + ui.item.value), |
|
|
|
|
requestObj, requestName, |
|
|
|
|
treeLoadHandler = function (data) { |
|
|
|
|
// make checkboxes selected after loading
|
|
|
|
|
self._loadParentTree(data, function () { |
|
|
|
|
self._checkCheckBox(ui.item.value); |
|
|
|
|
}); |
|
|
|
|
$checkbox = $('#id_' + ui.item.value); |
|
|
|
|
}; |
|
|
|
|
// load tree related to selected item
|
|
|
|
|
if (!$checkbox.length) { |
|
|
|
|
|
|
|
|
|
requestObj = { |
|
|
|
|
id: ui.item.value, |
|
|
|
|
name: ui.item.name |
|
|
|
|
}; |
|
|
|
|
getRequest(requestObj, self.opt.getParentUrl, treeLoadHandler); |
|
|
|
|
} else{ |
|
|
|
|
$checkbox.prop('checked', true); |
|
|
|
|
$checkbox.trigger('change'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
self.$inputFilter.val(ui.item.label); |
|
|
|
|
} |
|
|
|
|
self.selectTag({id:ui.item.id,name:ui.item.name}); |
|
|
|
|
self.$inputFilter.val(ui.item.label); |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* execute after client side recieve server response after enter 2 or above letter in autooomplete |
|
|
|
|
* do Jquery UI autocomplete initialization and executing |
|
|
|
|
* @param data - data object recieved from server. example {id: -2090174,name: "ci",text: "Бангалор"} |
|
|
|
|
*/ |
|
|
|
|
requestHandler = function(data){ |
|
|
|
|
dataObj = data; |
|
|
|
|
for(index = 0; index < dataObj.length; ++index) { |
|
|
|
|
@ -1609,7 +1589,6 @@ if (EXPO.searchBlock){ |
|
|
|
|
self.$inputFilter.val(''); |
|
|
|
|
self.$inputFilter.trigger('keyup'); |
|
|
|
|
event.preventDefault(); |
|
|
|
|
// return ui.label;
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
self.$inputFilter.autocomplete('search',""); |
|
|
|
|
@ -1646,7 +1625,7 @@ if (EXPO.searchBlock){ |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* loads and shows list tree related to selected id |
|
|
|
|
* @param {Object} data - is JSON object with information about parent elements. |
|
|
|
|
* @param {Object} data - is JSON object with information about parent elements.({text: "Германия", id: 47, parent: {text: "Европа", id: 4, name: "area"}, name: "co"}) |
|
|
|
|
* @param {function} handler - callback function |
|
|
|
|
* @param {number} counter |
|
|
|
|
* @private |
|
|
|
|
@ -1658,14 +1637,19 @@ if (EXPO.searchBlock){ |
|
|
|
|
$midleLevelCheckbox = $('#id_'+dataObj.id), |
|
|
|
|
/** |
|
|
|
|
* makes request in order to recieve children list information fires after request for parent list |
|
|
|
|
* @param {number} length |
|
|
|
|
* @param {number} length - the number of received elements |
|
|
|
|
* @function |
|
|
|
|
*/ |
|
|
|
|
handlerNested = function (length) { |
|
|
|
|
var $checkbox = $('#id_'+dataObj.id), |
|
|
|
|
afterAll = function () { |
|
|
|
|
index = 0, |
|
|
|
|
afterAll = function (number) { |
|
|
|
|
$waiter.hide(); |
|
|
|
|
counter||counter===0?handler(counter):handler(); |
|
|
|
|
index++ |
|
|
|
|
if(index == number){ |
|
|
|
|
|
|
|
|
|
counter||counter===0?handler(counter):handler(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
$waiter.hide(); |
|
|
|
|
if($checkbox.length && getObjectLength(self.curDNA[sublistTemplateId+'-sub']) == length){ |
|
|
|
|
|