Error getAttribute( )

Hello, my name is Wilson Rivera,'m Latino and my English is not very good, I hope I understand

Reviewing the documents, specifically the method getAttribute (itemId, attribute).

When I test this method, the browser throws the error “is not a function tree.getAttribute”.

The documentation says it requires the library “dhtmlxtree.js”. Indeed that library is loaded in the DOM, and yet throws this error.

many Thanks

Checking the source code, I found that the “getAttribute (itemId, attr)” is not defined in “dhtmlxtree.js”.

I added in the source code as follows:

htmlXTreeObject.prototype.getAttribute = function (id, attr) { console.log ("get the attribute is requested" "+ attr +" 'node with id =' "+ id +" '"); };

After the browser generates this error.

How I can implement this feature?

The documentation says that I should just call the function and pass the parameters as indicated in the documentation website http://docs.dhtmlx.com/doku.php?id=dhtmlxtree:api_method_dhtmlxtreeobject_getattribute

thanks

Doing some tests, I implemented this function to respond to the request of “getAttribute”.

Not sure if it is the right way to do it.

Annex to the function code. This should be added to the end of the document “dhtmlxtree.js”

[code]dhtmlXTreeObject.prototype.getAttribute=function(id, attr){

var respuesta=null;
if(typeof attr === 'string'){
    var item = this._globalIdStorageFind(id);
    switch(attr){
        case 'text': respuesta=item.label; break;
        case 'id': respuesta=item.id; break;
        case 'checked': respuesta=item.checkstate; break;
        case 'im0': var images=item.images;                  
                    respuesta=images[0];
                    break;
        case 'im1': var images=item.images;                        
                    respuesta=images[1];
                    break;
        case 'im2': var images=item.images; 
                    respuesta=images[2];
                    break;
        case 'open': respuesta=item.closeble;
                     break;
        default: respuesta="atributo no soportado";
    }
}

return respuesta;    

};[/code]

Hello
Everything is easier, than you think: this method needs connection of the dhtmlxtree_attrs.js extension:
docs.dhtmlx.com/doku.php?id=dhtm … tattribute