PDA

View Full Version : RecordField DefaultValue missing quotes v0.6



Mark.Cooke
Dec 09, 2008, 4:49 PM
Not sure if this is a bug, but I thought I'd submit it anyway in case anyone else is having the same problem.



<ext:Store ID="DataStore" runat="server">
<Reader>
<ext:JsonReader ReaderID="ItemOID">
<Fields>
<ext:RecordField Name="ItemOID" Type="String" DefaultValue="00000000-0000-0000-0000-000000000000" />
<ext:RecordField Name="Category" Type="Int"></ext:RecordField>
<ext:RecordField Name="Amount" Type="Float"></ext:RecordField>
<ext:RecordField Name="Comments" Type="String"></ext:RecordField>
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>


Upon inserting new records to the store, the defaultvalue for ItemOID becomes the number 0, not the Guid.Empty value as expected. Turns out that the DefaultValue attribute gets rendered without enclosing quotes.

My fix was to include my own enclosing single quotes.

Vladimir
Dec 09, 2008, 5:00 PM
Hi,

I don't recomend to set default value for ID field because ID field must be unique. Otherwise you can get unpredictable behaivor of GridPanel/Store. The client side API genereates temp unique ids. Then on server you can change it with own values (you can use Confirmation ID mode or reload grid after saving)