有空值的EXTJS商店问题 - useNull:没有影响 - 帮助?

Joh*_*don 7 combobox extjs jsonstore

伙计们,

我有一个由JSONStore支持的组合框组件.加载到商店的数据为组合框的值返回null.该值为int.JSON解码过程将空值转换为零; 导致组合框在尝试查找pk时无法呈现,在其后备存储中不存在零.

我找到了data.Field对象的useNull:config选项,升级到3.3.0 Final并将组合框的int值设置为useNull:true.遗憾的是,这根本没有任何影响.解码后的值仍然从零变为零.

当JSON字段的数据为空时,有关如何不将字段设置为零的任何想法?

这是一张正在发生的事情的照片.注意数据:value为零,但JSON值为null.

谢谢!

(gah!stoopid声誉<10所以我不能直接发布图片.查看此处: debug pic)

此外,这是我的商店的字段配置:

  fields: [
        {name:"id", type:"int"},
        {name:"occurenceDate", dateFormat: 'Y-m-d\\TH:i:s', type:"date"},
        {name:"docketNumber", type:"string"},
        {name:"courtLocationId", type:"int", useNull:true},
        {name:"assignedOfficerId", type:"int", useNull:true},
        {name:"primaryIncidentTypeId", type:"int", useNull:true},
        {name:"secondaryIncidentTypeId", type:"int", useNull:true},
        {name:"tertiaryIncidentTypeId", type:"int", useNull:true},
        {name:"incidentLocation", type:"string"},
        {name:"summary", type:"string"},
        {name:"personalItemsSeized", type:"string"},
        "supplements",
        "parties",
        "judgeIds"
    ]
Run Code Online (Sandbox Code Playgroud)

小智 3

尝试在没有类型声明的情况下使用它。您还可以使用转换方法:

{
    name: "primaryIncidentTypeId", 
    convert: function(value, row) {
        return (value == null) ? null : parseInt(value);
    }
}
Run Code Online (Sandbox Code Playgroud)