SOLVED:
I am get the following error:
I am removing all of the items of a listbox and then adding new items. It works the first time but when i call the JavaScript function the second time I get an error.
I have a drop down that is loading the array as an attribute and I call this function using onSelectedIndexChanged.
Any ideas?
Marty
Not sure what part fixed this issue but here is the new code if anyone has the same issue.
I am get the following error:
I am removing all of the items of a listbox and then adding new items. It works the first time but when i call the JavaScript function the second time I get an error.
//rangeitems looks like: "25|1.25,50|1.00,100|.85,125|.70"
var
items = listbox.get_items();
items.forEach(
function
(item) {
items.remove(item);
listbox.trackChanges();
listbox.get_items().remove(item);
listbox.commitChanges();
});
for
(i = 0; i < rangeitems.length; i++) {
var
items = rangeitems[i].split(
"|"
);
var
item =
new
Telerik.Web.UI.RadListBoxItem();
item.set_text(items[1]);
item.set_value(items[0]);
listbox.trackChanges();
listbox.get_items().add(item);
listbox.commitChanges();
}
I have a drop down that is loading the array as an attribute and I call this function using onSelectedIndexChanged.
Any ideas?
Marty
Not sure what part fixed this issue but here is the new code if anyone has the same issue.
var
items = listbox.get_items();
items.clear();
items.forEach(
function
(item) {
items.remove(item);
listbox.trackChanges();
listbox.get_items().remove(item);
listbox.commitChanges();
});
for
(i = 0; i < rangeitems.length; i++) {
listbox.trackChanges();
var
items = rangeitems[i].split(
"|"
);
var
item =
new
Telerik.Web.UI.RadListBoxItem();
item.set_text(items[1]);
item.set_value(items[0]);
listbox.trackChanges();
listbox.get_items().add(item);
listbox.commitChanges();
}