Endless looping when loading XML in Grid

Hi all,
I have a simple situation where I need 2 grids.

On init the first grid is loaded with some data.

When the user selects a row from the 1st grid then the 2nd one will load some data based on the selected row.

I have attached an event to the 1st Grid and in the event’s function I call the 2nd grid to load the XML using the command “mygrid.load”

But as I can see in the Chrome Console the dhtmlx.js is calling the service all the time

I dont understand if i am doing something wrong or i am missing something.

here is my code

[code]var Gmap;
var selectedGuardId = -1;
var selectedPatrolId = -1;
var lineCoordinates = new Array();
var markers = new Array();
var infowindow = new Array();
var patrol_addresses = new Array();
var form_1;
var guards_grid,patrols_grid,patrol_details_grid,patrol_status_bar;
var isAutoRefreshing = false;
//Event IDs
var patrolsXLS,patrolsXLE,guardsXLS,guardsXLE,detailsXLS,detailsXLE;
//-----------------------------------------------------------------------------------------

dhtmlx.image_path=’./codebase/imgs/’;

//EVENT FUNCTIONS
//-----------------------------------------------------------------------------------------
function onDoneLoading(grid_obj,count)
{
jQuery(‘body’).removeClass(“loading”);
}

function onLoading(grid_obj,count)
{
jQuery(‘body’).addClass(“loading”);
}

function GuardsGridRowSelect(id,ind)
{
selectedGuardId = id;
if(selectedGuardId != -1)
{
try
{
if(patrols_grid.getRowsNum() > 0)
patrols_grid.clearAll();
if(patrol_details_grid.getRowsNum() > 0)
patrol_details_grid.clearAll();
patrol_status_bar.setText(“Συνολικός χρόνος περιπολίας: —”);
var fromCal = DateToUnix(form_1.getCalendar(‘from_calendar’));
//patrols_grid.updateFromXML(‘get_patrols_head_readonly.php?guardid=’+selectedGuardId+’&fromdate=’+fromCal,true,true,null);
patrols_grid.load(‘get_patrols_head_readonly.php?guardid=’+selectedGuardId+’&fromdate=’+fromCal,‘xml’);
}
catch(e)
{
alert("Προέκυψε ένα σφάλμα! Παρακαλώ ανανεώστε την σελίδα! "+ e.message);
}
}//if
}

function DateSelectorClick()
{
var toCal = form_1.getCalendar(‘to_calendar’);
var fromCal = form_1.getCalendar(‘from_calendar’);
if( toCal < fromCal)
{
alert(“Παρακαλώ επιλέξτε ημερομηνία”);
}
else
{
if(selectedGuardId != -1)
{
try
{
if(patrols_grid.getRowsNum() > 0)
patrols_grid.clearAll();
var fromCal = DateToUnix(form_1.getCalendar(‘from_calendar’));
var toCal = DateToUnix(form_1.getCalendar(‘to_calendar’));
patrols_grid.load(“get_patrols_head_readonly.php?guardid=”+selectedGuardId+"&fromdate="+fromCal+"&todate="+toCal,‘xml’);
//patrols_grid.updateFromXML(‘get_patrols_head_readonly.php?guardid=’+selectedGuardId+’&fromdate=’+fromCal,true,true,null);
}
catch(e)
{
alert("Προέκυψε ένα σφάλμα! Παρακαλώ ανανεώστε την σελίδα! "+ e.message);
}
}//if
}//else
}//DateSelectorClick
//-----------------------------------------------------------------------------------------
function init()
{

var main_layout = new dhtmlXLayoutObject(document.getElementById('main_container') || document.body, '2U');

var a = main_layout.cells('a');
a.setWidth('300');
a.fixSize(1,0);
var layout_1 = a.attachLayout('3E');
layout_1.setEffect('collapse', false);
layout_1.setAutoSize("","a;c");
var guards_cell = layout_1.cells('a');

var layout_4 = guards_cell.attachLayout('2E');
layout_4.setAutoSize("","b");
var guards_cell2 = layout_4.cells('b');
var info_cell = layout_4.cells('a');
info_cell.hideHeader();
info_cell.setHeight('65');

info_cell.fixSize(1,0);
guards_cell2.fixSize(1,0);
guards_cell.fixSize(1,0);

var tmpstr = [
	{ 
		type:"label" , //label  
		label: "<a href='/?q=kerverosqrpatrol'><img alt='kerveroslive logo' src='/sites/kerveroslive.com/files/zeropoint_logo.png' width='100%'></a>"  
	}
];
var imageForm = info_cell.attachForm(tmpstr);
imageForm.attachEvent("onButtonClick", function(name) {
	window.location.href="http://www.kerveroslive.com";
	});

guards_cell2.setText('Φύλακες');
layout_1.setCollapsedText('a', 'Φύλακες');

//GUARDS GRID
//-----------------------------------------------------------------------------------------
guards_grid = guards_cell2.attachGrid();
guards_grid.setIconsPath('lib/imgs/');

guards_grid.setHeader(["ID","Όνομα"]);
guards_grid.setColTypes("ro,ro");

guards_grid.setColSorting('str,str');

guards_grid.attachEvent("onRowSelect",GuardsGridRowSelect);
guards_grid.attachEvent('onXLE',onDoneLoading);
guards_grid.attachEvent('onXLS',onLoading);
guards_grid.init();

guards_grid.load('get_guard_readonly.php','xml');
//-----------------------------------------------------------------------------------------

//Date SELECTOR
//-----------------------------------------------------------------------------------------
var datepicker_cell = layout_1.cells('b');
datepicker_cell.setText('Επιλογή ημερομηνίας');
datepicker_cell.setHeight('120');//150
datepicker_cell.setWidth('250');
datepicker_cell.fixSize(1,0);
layout_1.setCollapsedText('b', 'Επιλογή ημερομηνίας');

var str = [
	{ type:"settings" , labelWidth:80, inputWidth:250, position:"absolute"  },
	{ type:"calendar" , name:"to_calendar", label:"Μέχρι", dateFormat:"%d/%m/%Y", labelWidth:125, inputWidth:125, options:{
		
	}, labelLeft:136, labelTop:5, inputLeft:136, inputTop:21  },
	{ type:"calendar" , name:"from_calendar", label:"Από", dateFormat:"%d/%m/%Y", labelWidth:125, inputWidth:125, options:{
		
	}, labelLeft:5, labelTop:5, inputLeft:5, inputTop:21  },
	{ type:"button" , name:"form_button_1", label:"Ανανέωση περιπολιών", value:"Ανανέωση περιπολιών", width:"200", command:"validate", inputLeft:5, inputTop:49  }
];

form_1 = datepicker_cell.attachForm(str);
//console.log (form_1);	
var toCal = form_1.getCalendar('to_calendar');
var fromCal = form_1.getCalendar('from_calendar');
toCal.value = getCurrentDate();
fromCal.value = getCurrentDate();

//put code to handle the button clicks
form_1.attachEvent("onButtonClick", DateSelectorClick);
//-----------------------------------------------------------------------------------------

//Patrols GRID
//-----------------------------------------------------------------------------------------
var routes_cell = layout_1.cells('c');
routes_cell.setText('Περιπολίες');
routes_cell.setWidth('250');
routes_cell.fixSize(1,0);
layout_1.setCollapsedText('c', 'Περιπολίες');
patrols_grid = routes_cell.attachGrid();
patrols_grid.setIconsPath('lib/imgs/');

patrols_grid.setHeader(["ID","Ημερομηνία"]);
patrols_grid.setColTypes("ro,ro");

patrols_grid.setColSorting('str,str');
patrols_grid.setColumnMinWidth('200', 1);
patrols_grid.setColWidth(0, '20');

patrols_grid.attachEvent("onXLE", onDoneLoading);
patrols_grid.attachEvent("onXLS", onLoading);
patrols_grid.init();

//-----------------------------------------------------------------------------------------

}//init
[/code]

the page is here
http://kerveroslive.com/qrpatrol/qrpatrolDev.php

Thank you for the help

forgot to mention that in order to access the page you need to login here
http://kerveroslive.com/

with username: demo
pawword: demo

then goto to the following page
kerveroslive.com/qrpatrol/qrpatrolDev.php

open the Chrome console or your browser’s console to monitor the requests and on the page

select Guard-> Demo
select Patrol -> 1

Thanks

Unfortunately the issue cannot be reproduced in your demo.