Categories
ExtJS Javascript Sencha Touch

Adding Before & After Filters in Sencha Touch MVC Controllers

BeforeFilters in RoR are a great way to manage controller accesses or do execute any other specific controller action triggers.

Here is a simple way of mimicking this great RoR feature on Sencha Touch MVC.

Create a file named app/controllers/Controllers.js with the following content:

Include this in your HTML document.

Now, you can add your beforeFilter action to all your controllers like following:

Reference: Adding Callbacks to your Sencha Touch Controllers