dhtmlxerror

Hi,
can i use one dhtmlxError.catchError(“ALL”,myErrorHandler); for all components like grid, form , etc…

And how can i identify which component is failed to load data?

Thanks in advance,
Naresh Adla

Hi
You need this:
docs.dhtmlx.com/doku.php?id=dhtm … r_response
Where data[0] - request object

Hi Mr Darya,

Thanks for your kind reply.
However it is not sufficient solution for my question.

My question is :

How can i identify whether grid or form failed to load data.

My code will like:

var mylayout = new dhtmlxLayoutObject(document.body,‘2U’);
var myform = mylayout.cells(‘a’).attachForm();
myform.loadStruct(‘myform.xml’);

var mygrid = mylayout.cells(‘b’).attachGrid();
// configuration of mygrid
mygrid.init();
mygrid.load(‘mygriddata.xml’);

//and i have one dhtmlxerror event

dhtmlxError.catchError(“ALL”,function(a,b,data){
//data[0] - request object
//data[0].responseText - incorrect server side response
});

So is there any way to find which component(form or grid) has failed to load data?

Thanks in advance,
Naresh Adla

You just need to use the next check:
if(data[0] == mygrid){ … }
This what you will indentify, that requested object is exactly the grid.

Hi Darya thanks for ur reply,

In the callbackhandler
data[0] is giving [object XMLHttpRequest], not grid.

Oh, sorry… I’ve mixed the parameters…
You need data[1], not [0]…

You said data[1] gives the name of the component.

In my code i am loading a form with loadStruct(url).
and my form name is ‘formone’.
but it is giving data[1] as ‘window’.

Hello,

here is an example:

var mylayout = new dhtmlxLayoutObject(document.body,‘2U’);
var myform = mylayout.cells(‘a’).attachForm();
myform.loadStruct(‘myform.xml’);

var mygrid = mylayout.cells(‘b’).attachGrid();
// configuration of mygrid
mygrid.init();
mygrid.load(‘mygriddata.xml’);

function yourErrorHandler(type, name, data){

 // error has been occurred in grid
if(data[1] == mygrid){
     // your code
}
else if(data[1] == myform){
     // your code

}
}
dhtmlxError.catchError(“ALL”,yourErrorHandler);

You said data[1] gives the name of the component.

data[1] refers to the component (object) where an error occurred - please see the sample above.

Hello,

here is an example:

[code]var mylayout = new dhtmlxLayoutObject(document.body,‘2U’);
var myform = mylayout.cells(‘a’).attachForm();
myform.loadStruct(‘myform.xml’);

var mygrid = mylayout.cells(‘b’).attachGrid();
// configuration of mygrid
mygrid.init();
mygrid.load(‘mygriddata.xml’);

function yourErrorHandler(type, name, data){

 // error has been occurred in grid
if(data[1] == mygrid){
     // your code
}
else if(data[1] == myform){
     // your code

}
}
dhtmlxError.catchError(“ALL”,yourErrorHandler);
[/code]

You said data[1] gives the name of the component.

data[1] refers to the component (object) where an error occurred - please see the sample above.