PDA

View Full Version : Moving fields in a formpanel



ssayen
28 Aug 2012, 4:00 AM
Hello,

I need to reorder fields in a FormPanel. User can do this with a context menu on the field itself (up/down).
I thought it would be really easy to do this way ("up" handler) :



var correctionPanel = this.correction.questionForm.colonneDroite;
correctionPanel.remove(this.correction, false);
correctionPanel.insert(this.correction.index - 1, this.correction);
correctionPanel.doLayout();


The panel is the right column in a column layout FormPanel.
this.correction.index stores the current index of the field. I'll update it later.
The field disappears, but doesn't reappear.
But when I log correctionPanel items, I've got the right items in the right order.

Did I miss something ?
Thanks a lot ;)

ssayen
28 Aug 2012, 7:05 AM
Ok I solved this one, but it's weird.
I solved it by setting manually 'rendered' to false when I remove it from the panel. Then it appears again when I add it. I don't like that, because I don't understand, but, it works :-?