FormPanel question / possible bug

13 views
Skip to first unread message

Scott Mills

unread,
Jan 9, 2012, 4:57:25 PM1/9/12
to Netzke
I have a grid panel that loads a record into a FormPanel when a record
is selected.

I noticed that if a record is loaded that has values for all fields
and then I load in another record after it that has a field with a nil
value, the 1st records value remains in that field.

Example:
load record 1 = {:foo => "test 1", :bar => "junk"}
load record 2 = {:foo => "test 2", :bar => nil}

Form now contains {:foo => "test 2", :bar => "junk"}

I was using the netzke_load endpoint in the FormPanel which uses
set_form_values to update the values. The problem is the hash that is
sent over to set_form_values has all the nils stripped out because of
the Hash to_nifty_json method.

My first question is should I be loading a FormPanel another way?

Is there a reason to strip out items in a hash with nil values other
than saving data sent back to the client? I thought about removing
the recursive_delete_if_nil call in to_nifty_json but I was afraid of
unintended consequences.

For now I am working around this by manually clearing out all of the
fields before setting the new values with this:
this.getForm().getFields().each(function(f){f.setValue();});
(where this is the FormPanel)

I'm sure there is a better work around but I am still learning Netzke
and Ext. Thanks for any help you can provide.

Scott

P.S. I am really liking netzke. Thanks to everyone who has
contributed.
Reply all
Reply to author
Forward
0 new messages