I have a form with a combobox with a grid below that. The columns in the grid can change depending on what the user selects in the combobox.

I understand that you can change the store and columns of a grid with the Ext.grid.Panel.reconfigure() method.

But, how can I change the underlying model? I was thinking about just using PHP to generate a JavaScript file with the correct model. Can I just redefine the model? by calling Ext.define('...', extend: 'Ext.data.Model', ...) again?

Also, how can I load the contents of a JavaScript file on the fly? What is the method EXT JS uses?

Much appreciated,
-Stephen Tyler