title: Implementing dynamic forms in ExtJS
body: <p>I am doing preliminary analysis for turning static forms in an ExtJS 5.x app into dynamic ones, since there is a lot of redundancy in several of the app's forms in terms of structure and this would allow for ease of creation in new forms with similar structure.</p>
  
  <p>One issue I cannot wrap my head around is how to deal with event listeners in terms of JSONifying them. For example, I have the following listener attached to a button: </p>
  
  <pre><code>{
      "xtype": 'button',
      "text": 'Constrain search by date range',
      "itemId": 'showWhen',
      "hidden": false,
      listeners: {
          click: function (button) {
              button.up('grid').down('#whenId').show();
              button.up('grid').down('#whenValue').show();
              button.up('grid').down('#hideWhen').show();
              button.up('grid').down('#showWhen').hide();
          }
      }
  }
  </code></pre>
  
  <p>How do I pass the <code>up</code>, <code>down</code>, etc., methods as JSON? Or, more generally, how do I deal with the entire listener object?</p>