EXTJS 存储存在空值问题 -- useNull:没有影响 -- 帮助吗?
各位,
我有一个由 JSONStore 支持的组合框组件。加载到存储中的数据为组合框的值返回 null。该值是一个整数。 JSON 解码过程是将 null 值转换为零;导致组合框在尝试查找其后备存储中不存在的 pk, 0 时无法呈现。
我找到了 data.Field 对象的 useNull: 配置选项,升级到 3.3.0 Final 并将组合框的 int 值设置为 useNull:true。不幸的是,这根本没有任何影响。解码后的值仍然从空变为零。
关于当 JSON 字段的数据为空时如何不将字段设置为零的任何想法?
这是正在发生的事情的图片。请注意 data: 值为零,但 JSON 值为 null。
谢谢!
(啊!愚蠢的声誉<10,所以我不能直接发布图片。在这里查看:调试图片< /a> )
另外,这是我商店的字段配置:
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"
]
Folks,
I have a combobox component backed by a JSONStore. The data loaded into the store is returning null for the combobox's value. The value is an int. The JSON decode process is converting the null value into a zero; causing the combobox to fail to render when it attempts to find the pk, zero that doesn't exist in its backing store.
I've found the useNull: config option for data.Field objects, upgraded to 3.3.0 Final and set my int value for the combobox to useNull:true. This isn't having any affect at all, unfortunately. The decoded value is still being changed from null to zero.
Any ideas about how to not set the field to a zero when the data for a JSON field is null?
Here's a pic of what's going on. Notice the data: value is zero, but the JSON value is null.
Thanks!
(gah! stoopid reputation < 10 so I can't directly post the pic. View it here: debug pic )
Also, here's my store's field config:
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"
]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
尝试在没有类型声明的情况下使用它。您还可以使用转换方法:
Try using it without type declaration. You may also use convert method:
关于组合宽度:我通常
在表单声明中使用,并且宽度没有问题。
难道不能从服务器端与所有其他元数据一起提供转换功能吗?
我仍在使用 ExtJS 3.2 - 生产系统中不需要任何新错误:)
About the combo width: I usually use
in the form declaration and have no problems with widths.
Isnt't it possible to provide convert functions from server side together with all other metadata?
And I'm still using ExtJS 3.2 - no need of any new bugs in the production systems :)
这也吸引了我,您还可以重写 Ext.data.Types 中的类型转换函数,以允许整数类型字段为空值。
This also got me, you can additionally override the type convert function in Ext.data.Types to allow null values for integer type fields.
您必须使用
defaultValue: null ,useNull : true
因为 integet 类型的默认值为零示例:
You must use
defaultValue: null ,useNull : true
because default value for integet type is zeroExample: