I create a button on a dhtmlxtoolbar object with XML:
<item type="button" id="export" text="Export"/>
The HTML for the button looks like this:
<div>Export</div>
Is there a way to do this?
<div id="custom_id">Export</div>
I create a button on a dhtmlxtoolbar object with XML:
<item type="button" id="export" text="Export"/>
The HTML for the button looks like this:
<div>Export</div>
Is there a way to do this?
<div id="custom_id">Export</div>
I’m trying to attach an object from a javascript tooltip class. It needs the id of the element to attach correctly attach, but I can’t find anything unique about the button. The div for the button is inside of several other div objects, but none of them have an id. I need to be able to set a unique identifier, but preferably it would be the id.
You can set tooltips by attribute “title” inxml:
<item id="filter" type="buttonTwoState" img="filter.gif" imgdis="filter_dis.gif" text="Filter" title="Filter"/>
Or use the method setItemToolTip(itemId, tip) to set it and setItemToolTipTemplate(itemId, template) to set its template.
The tooltips offered by dhtmlx aren’t as powerful as other libraries. I don’t want to be forced to style a tooltip with CSS and to create all of the events manually when I have a licensed version of an extremely easy and powerful tooltip library.
All I need is a way to identify the div that is created in the toolbar as my button.
Here are the tooltips I’m talking about - dhtmlx has nothing like this. projects.nickstakenburg.com/tipped
I figured out the answer. This really needs to be changed in dhtmlx. Not being able to get a reference to the element without looping over the entire document is ridiculous. Other libraries should be able to easily use dhtmlx objects.
[code]var tbObj = document.getElementsByClassName(“dhx_toolbar_base_18_dhx_blue”);
var tbDivs = tbObj[0].getElementsByTagName(“div”)
for (var i = 0; i < tbDivs.length; i < i++) {
if (tbDivs[i].innerHTML == “Export”) {
tbDivs[i].id = “export_button_id”;
break;
}
}[/code]
getElementsByClassName is not supported in IE8.
You may try to use something like so:
toolbar.forEachItem(function(itemId){
var item = toolbar.objPull[toolbar.idPrefix+itemId];
if(item.obj)
item.obj.id = itemId;
});