The problem with EXTJS Store with null values ​​is useNull: not affected. --Help?

People,

I have a combobox component supported by JSONStore. Data uploaded to the repository returns null for the combobox value. The value is int. The JSON decoding process converts a null value to zero; as a result, the combo box cannot render when trying to find pk, a zero that does not exist in its backup storage.

I found the useNull: config parameter for data.Field objects updated to 3.3.0 Final and set the int value for combobox to use Null: true. Unfortunately, this has no effect. The decoded value still changes from zero to zero.

Any ideas on how to not set the field to zero when the data for the JSON field is zero?

Here is a photo of what is happening. Pay attention to the data: the value is zero, but the JSON value is null.

Thanks!

(gah! stoopid reputation <10, so I can't post the pic directly. See here: debug pic )

Also, here is my storage configuration:

fields: [ {name:"id", type:"int"}, {name:"occurenceDate", dateFormat: 'Ymd\\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" ] 
+7
extjs combobox jsonstore
source share
4 answers

Try using it without a type declaration. You can also use the conversion method:

 { name: "primaryIncidentTypeId", convert: function(value, row) { return (value == null) ? null : parseInt(value); } } 
+3
source share

About combo width: I usually use

 defaults: { anchor: '100%' } 

in the form declaration and has no problems with width.

Is it not possible to provide conversion functions from the server side along with all other metadata?

And I'm still using ExtJS 3.2 - there is no need for any new bugs in production systems :)

0
source share

It also led me to the fact that you can further override the type conversion function in Ext.data.Types to allow null values ​​for integer type fields.

 Ext.data.Types.INT.convert = function(v){ v = parseInt(String(v).replace(Ext.data.Types.stripRe, ''), 10); return isNaN(v) ? null : v; }; 
0
source share

You should use defaultValue: null ,useNull : true , because the default value for type integet is zero

Example:

 {name:"primaryIncidentTypeId", type:"int", useNull:true , defaultValue: null }, 
-one
source share

All Articles