Results 1 to 4 of 4

Thread: deep copy/clone formpanel

  1. #1

    Default deep copy/clone formpanel


    How do I make a deep copy of a FormPanel?
    Something like :

    var newform = deepcopy(existingform);



  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    The Netherlands


    And with a deep copy you mean a copy with all nested components?

    That's not 100% possible in Ext. You are better of creating a factory method that returns instances of the same form.

  3. #3

    Default thank you

    ok, is that by just giving the existing form as an argument to the
    constructor of the FormPanel class? And if I have two instances
    will a change of a value in oneinstance also change it in the other


  4. #4
    Sencha User BitPoet's Avatar
    Join Date
    Sep 2008


    Condor means that instead of instanciating each formpanel on its own, like
    var fp1 = new Ext.form.FormPanel({
      title: 'panel1',
      items: [
        { fieldLabel: 'value1', name: 'value1' }
    var fp2 = new Ext.form.FormPanel({
      title: 'panel2',
      items: [
        { fieldLabel: 'value1', name: 'value1' }
    you should wrap the instanciating in its own function and only pass in the differing values, e.g.
    createfp = function(conf) {
      return new Ext.form.FormPanel(
          items: [
            { fieldLabel: 'value1', name: 'value1' }
        }, conf);
    var fp1 = createfp({title: 'panel1'});
    var fp2 = createfp({title: 'panel2'});
    If you try to deep copy values from an existing formpanel instance, you'll likely get in over your head, as it is almost impossible to check exactly how deep you need to copy (just think about layout managers or plugins that store ids of child elements at creation time).

Similar Threads

  1. [SOLVED] Copy, clone or duplicate a JsonStore
    By skaue in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 3 May 2012, 11:34 PM
  2. Clone a FormPanel object
    By stiptkevin in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 4 Jun 2010, 12:41 AM
  3. copy/clone Node when DDProxy
    By dgielis in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 24 Jun 2008, 4:36 AM
  4. Clone/Copy Node (instead of Move) during Drag
    By mattc58 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 13 Dec 2007, 7:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts