[-] BO : fixed js global conflict for categories tree
This commit is contained in:
+11
-11
@@ -29,7 +29,7 @@ var needCheckAll = false;
|
||||
var needUncheckAll = false;
|
||||
var interval = null;
|
||||
var intervalCheck = null;
|
||||
var id = 0;
|
||||
var id_tree = 0;
|
||||
var arrayCatToExpand = new Array();
|
||||
|
||||
function buildTreeView()
|
||||
@@ -113,7 +113,7 @@ function setCategoryToExpand()
|
||||
{
|
||||
var ret = false;
|
||||
|
||||
id = 0;
|
||||
id_tree = 0;
|
||||
arrayCatToExpand = new Array();
|
||||
$('#categories-treeview').find('li.expandable:visible').each(function() {
|
||||
arrayCatToExpand.push($(this).attr('id'));
|
||||
@@ -145,7 +145,7 @@ function openCategory()
|
||||
{
|
||||
// Check readyToExpand in order to don't clearInterval if AJAX request is in progress
|
||||
// readyToExpand = category has been expanded, go to next ;)
|
||||
if (id >= arrayCatToExpand.length && readyToExpand)
|
||||
if (id_tree >= arrayCatToExpand.length && readyToExpand)
|
||||
{
|
||||
if (!setCategoryToExpand())
|
||||
{
|
||||
@@ -170,10 +170,10 @@ function openCategory()
|
||||
|
||||
if (readyToExpand)
|
||||
{
|
||||
if ($('#categories-treeview').find('li#'+arrayCatToExpand[id]+'.hasChildren').length > 0)
|
||||
if ($('#categories-treeview').find('li#'+arrayCatToExpand[id_tree]+'.hasChildren').length > 0)
|
||||
readyToExpand = false;
|
||||
$('#categories-treeview').find('li#'+arrayCatToExpand[id]+'.expandable:visible span.category_label').trigger('click');
|
||||
id++;
|
||||
$('#categories-treeview').find('li#'+arrayCatToExpand[id_tree]+'.expandable:visible span.category_label').trigger('click');
|
||||
id_tree++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,8 +311,7 @@ function getParentCategoriesIdAndOpen(id_category)
|
||||
function openParentCategories()
|
||||
{
|
||||
intervalCheck = setInterval(checkCategory, 20);
|
||||
|
||||
if (id >= arrayCatToExpand.length && !readyToExpand)
|
||||
if (id_tree >= arrayCatToExpand.length && !readyToExpand)
|
||||
{
|
||||
clearInterval(interval);
|
||||
// delete interval value
|
||||
@@ -322,10 +321,11 @@ function openParentCategories()
|
||||
|
||||
if (readyToExpand)
|
||||
{
|
||||
if ($('li#'+arrayCatToExpand[id]+'.hasChildren').length > 0)
|
||||
if ($('li#'+arrayCatToExpand[id_tree]+'.hasChildren').length > 0)
|
||||
readyToExpand = false;
|
||||
$('li#'+arrayCatToExpand[id]+'.expandable span').trigger('click');
|
||||
id++;
|
||||
|
||||
$('li#'+arrayCatToExpand[id_tree]+'.expandable span').trigger('click');
|
||||
id_tree++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user