0

当我尝试删除数组中的所有元素时出现此错误,该数组是选择框的模型。据我了解,这是因为我选择了第一行并删除了所有项目,以便再次替换它们。我该怎么做才能工作?

// is only created the first time
weeks: new qx.data.Array()

// every time I change the year I have to
weeks.deleteAll();
// for each week in the year add the week
weeks.push(qx.data.marshal.Json.createModel({
     label: "week: " + weeksNum
    ,fromDay: week.startDay
    ,toDay: week.endDay
}));


// the view
var weeksSelectBox = new qx.ui.form.SelectBox();
var weeksController = new qx.data.controller.List(this.__headerData.weeks, weeksSelectBox, 'label');
content.add(weeksSelectBox);
weeksSelectBox.addListener("changeSelection", function(e) {
    var selectedItem = e.getData()[0];
    var model = null;
    if(selectedItem){
        model = selectedItem.getModel()
    }
    this.__component.onWeekSelected(model);
}.bind(this));
4

0 回答 0