ext combobox 当数据库值为NULL时显示异常 请教各位大侠 用combobox做显示, 当该字段值为空时, 理应显示空白,但是却显示的是默认为0的值, 或者值为0所对应的选项. 请问该如何解决~~~~~~~~~~~~~ 急~~~~~~~~~~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果数据库值为null时 你后台返回的数据是什么 发一段后台返回的数组上来看看另外:把你的combox的定义部分也发上来 实际情况是,我导入一个对象,该对象某个字段展现方式为 combobox , 导入时,该字段为空.修改该对象时,弹出修改窗口,为 combobox 却显示的是0或者是0对应的选项文本.{ xtype : 'combo', fieldLabel : '<span style="color: red; vertical-align: middle;">*</span> 业务类型', hiddenName : 'busnTypeID', triggerAction : 'all', displayField : 'busnType', valueField : 'busnTypeID', editable : false, store : new Ext.data.JsonStore({ autoLoad : true, url : APPBASE + '/CaseLibraries.do?method=findCFGBusinessTypeversion', fields : ['busnTypeID', 'busnType'] }) } 把这种情况下后台往前台传的json发下 JSONObject.fromObject看了下json这个方法把所有值为NULL的字段全部初始化为0了...谷歌了一下据说这样处理:jsonConfig.registerDefaultValueProcessor(Integer.class, new DefaultValueProcessor() { public Object getDefaultValue(Class type) { return null; } });使其当为Integer类型时,数据库为NULL时还是返回NULL,但是好像测试了下没效果不知道哪里错了 在jsonConfig 注册defaultValueProcessor // 设置Integer类型为空的默认值 json-lib默认是0 jsonConfig.registerDefaultValueProcessor(Integer.class, new DefaultValueProcessor() { public Object getDefaultValue(Class type) { return null; } });这样转换时Integer类型如果为null转换还是null,不会被转为0 我加在静态块里面,重启服务后,还是没反映...仍然是返回0 解决了 JSONObject.fromObject(fb,jsonConfig) 此时应该将jsonConfig 配置进来. 立即生效.... 怎样让jQueryUI 的日历控件显示中文日历? 请教JS一个问题 如果根据用户的选择在页面上打印相应的文本? 请教一个很简单的视频窗口全屏问题,答对马上给分!! 用什么办法可以取到客户端文件的修改时间 子窗体控制父窗体事件 请问怎么实现这样的功能:页面开始载入的时候跳出一个对话框,选择 是 就跳转到 a.htm,选择 否 就跳转到 b.htm!?谢谢! JS基础 JavaScript怎样获得图片的px值? jquery 得出css值后能不能用于计算? instanceof运算符 table 之为什么只改变第一行的值??
另外:把你的combox的定义部分也发上来
修改该对象时,弹出修改窗口,为 combobox 却显示的是0或者是0对应的选项文本.{
xtype : 'combo',
fieldLabel : '<span style="color: red; vertical-align: middle;">*</span> 业务类型',
hiddenName : 'busnTypeID',
triggerAction : 'all',
displayField : 'busnType',
valueField : 'busnTypeID',
editable : false,
store : new Ext.data.JsonStore({
autoLoad : true,
url : APPBASE
+ '/CaseLibraries.do?method=findCFGBusinessTypeversion',
fields : ['busnTypeID', 'busnType']
})
}
这个方法把所有值为NULL的字段全部初始化为0了...
谷歌了一下据说这样处理:jsonConfig.registerDefaultValueProcessor(Integer.class,
new DefaultValueProcessor() {
public Object getDefaultValue(Class type) {
return null;
}
});
使其当为Integer类型时,数据库为NULL时还是返回NULL,
但是好像测试了下没效果不知道哪里错了
// 设置Integer类型为空的默认值 json-lib默认是0
jsonConfig.registerDefaultValueProcessor(Integer.class,
new DefaultValueProcessor() {
public Object getDefaultValue(Class type) {
return null;
}
});这样转换时Integer类型如果为null转换还是null,不会被转为0
我加在静态块里面,重启服务后,还是没反映...仍然是返回0
此时应该将jsonConfig 配置进来. 立即生效....