ComboBoxItem未清除模糊的未知值

时间:2016-04-12 18:36:19

标签: smartclient

要开始,这是我的ComboBoxItem字段

{
    name: "State",
    type: "ComboBoxItem",
    canEdit: true,
    valueMap: {
        WI: "Wisconsin",
        IL: "Illinois",
        MN: "Minnesota",
        MI: "Michigan"
    },
    addUnknownValues: false,
    allowEmptyValue: false,
    completeOnTab: true
}

ComboBoxItemListGrid中的DynamicForm相比,isc.VLayout.create({ height: 500, width: 900, margin: 100, members: [ isc.ListGrid.create({ height: "100%", width: "100%", canEdit: true, modalEditing: true, extraSpace: 5, fields: [ { name: "Name", canEdit: true, }, { name: "State", type: "ComboBoxItem", canEdit: true, valueMap: { WI: "Wisconsin", IL: "Illinois", MN: "Minnesota", MI: "Michigan" }, addUnknownValues: false, //allowEmptyValue: false, completeOnTab: true } ], data: [ { Name: "Evan", State: "WI" }, { Name: "Erik", State: "IL" }, { Name: "Philip", State: "MI" }, ] }), isc.DynamicForm.create({ height: "100%", width: "100%", border: "1px solid #ababab", canEdit: true, fields: [ { name: "Name", canEdit: true, }, { name: "State", type: "ComboBoxItem", canEdit: true, valueMap: { WI: "Wisconsin", IL: "Illinois", MN: "Minnesota", MI: "Michigan" }, addUnknownValues: false, allowEmptyValue: false, completeOnTab: true } ], values: { Name: "Evan", State: "WI" } }) ] }); 中的行为与order中的行为截然不同。

在DynamicForm中,如果要输入一个在valueMap中没有匹配项的值,然后离开该字段,它将返回到先前的值。

在可编辑的ListGrid中,如果要输入一个在valueMap中没有匹配的值然后离开该字段,它将保留您输入的字符,并尝试使用该字符串保存编辑。

Walkthrough

演练中使用的代码

has_many

1 个答案:

答案 0 :(得分:0)

addUnknownValues似乎对这两个实例有不同的影响。

我通过将addUnknownValues移到ListGridField的editorProperties

来解决了这个问题

这是更新的ListGridField项目

{
    name: "State",
    type: "ComboBoxItem",
    canEdit: true,
    valueMap: {
        WI: "Wisconsin",
        IL: "Illinois",
        MN: "Minnesota",
        MI: "Michigan"
    },
    editorProperties:{
        addUnknownValues: false,
        allowEmptyValue: false,
        completeOnTab: true
    }
}