Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Trupti on Jan 09, 2008 22:46
open dhtmlx forum
penItemDynamic completion in dhtmlxtree 1.4 version

I am using dhtmlxTree Professional v1.4. how can i know if the openItemdynamic() operation has completed? When openItemDynamic() is provided with incorrect node id it throws a runtime javascript error. I need to provide a custom error message to user when openItemDynamic() fails or results in runtime error. I tried the following code snippet:

function my_error_handler(type, name, data){
alert("My error handler \n"+name+"\n Status:"+data[0].status);
}
dhtmlxError.catchError("openItemdynamic",my_error_handler);

But this code does not result in calling the my_error_handler() method when openItemDynamic() throws a runtime javascript error due to incorrect node id.

I also tried :
try{
openItemdynamic(list);
}
catch(err)
{
alert("Custom error msg");
}

But the above code does not work correctly all the times due to async behaviour of openItemDynamic() method.

is there any way in dhtmlxtree 1.4 version by which i can display appropriate message to user when openItemdynamic() fails or results in runtime javascript error?
Answer posted by Support on Jan 10, 2008 02:28
>> can i know if the openItemdynamic() operation has completed?
It can be done only by code customization, in tree 1.4 there is no any special event for such situation.

>>I need to provide a custom error message to user when openItemDynamic() fails
Error which can occur during opening can be caused only by incorrect element ID, because it not a normal situation it is not handled by inner error system, the only way to catch such error is code modification

    dhtmlxTree_xw.js  , function _stepOpen, line 459

     var temp=that._globalIdStorageFind(that.G_node);
next line can be added
    if (!temp) {
       custom_error_message();
       return;
    }