I have code that adds buttons to a kendoToolBar. Upon completion, the button is added but the .items array still says null or undefined. The basic gist I am ultimately after is how to iterate through the buttons/controls in a toolbar and delete them all or at least delete them one by one by id. But, I can't figure out the syntax for iterating this array. Can anyone point out what I'm doing wrong?
var toolbar = $("#tbrMyToolBar").data("kendoToolBar");
toolbar.add(
{
type: "button",
attributes: { "class": "k-button" },
text: name,
id: "testbutton",
togglable: false,
click: function(e)
{
}
});
console.log(toolbar.items.length);