Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EXTJS Store issue with Null Values -- useNull: doesn't have an affect --Help?

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"
    ]
like image 367
John Gordon Avatar asked Nov 01 '10 17:11

John Gordon


1 Answers

Try using it without type declaration. You may also use convert method:

{
    name: "primaryIncidentTypeId", 
    convert: function(value, row) {
        return (value == null) ? null : parseInt(value);
    }
}
like image 59
Donatas Olsevičius Avatar answered Sep 18 '22 13:09

Donatas Olsevičius