PHP Classes

File: web/bundles/examples/example/Grid/js/app/controller/Generic.js

Recommend this page to a friend!
  Classes of william amed   Raptor 2   web/bundles/examples/example/Grid/js/app/controller/Generic.js   Download  
File: web/bundles/examples/example/Grid/js/app/controller/Generic.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Raptor 2
Framework that takes routes from annotations
Author: By
Last change:
Date: 8 years ago
Size: 2,859 bytes
 

Contents

Class file image Download
Ext.define('Grid.controller.Generic', { extend: 'Ext.app.Controller', stores: ['Generic'], models: ['GenericModel'], refs: [{ ref: 'genericlist', selector: 'genericlist' }, { ref: 'buttonAdd', selector: 'viewport button[action=addAction]' }, { ref: 'buttonEdit', selector: 'viewport button[action=editAction]' }, { ref: 'buttonDelete', selector: 'viewport button[action=deleteAction]' } ], init: function() { this.control({ 'genericwindow button[action=save]': { click: this.addAction }, 'viewport button[action=addAction]': { click: this.onAddAction }, 'viewport button[action=editAction]': { click: this.onEditAction }, 'viewport button[action=deleteAction]': { click: this.onDeleteAction }, 'genericlist': { beforeselect: this.onListSelect, beforedeselect: this.onListDeSelect }, 'viewport':{ render:this.onRender } }); }, onRender:function(){ //Make Raptor control the UI to activate the privilege //Rpt.controlActions(); }, onListSelect: function() { this.getButtonEdit().enable() this.getButtonDelete().enable() }, onListDeSelect: function() { this.getButtonEdit().disable() this.getButtonDelete().disable() }, onAddAction: function() { var view = Ext.widget('genericwindow'); }, onEditAction: function() { var model=this.getGenericlist().getSelectionModel().getLastSelected(); var view = Ext.widget('genericwindow', {action: 'edit',title:'Modify'}); var form=view.down('form'); form.loadRecord(model); }, onDeleteAction: function() { Dino.msg.info(2,'Are you shure', this.deleteAction, this); }, addAction:function(button){ var win = button.up('window'), form = win.down('form'), values = form.getValues(); var record; this.getGenericlist().getSelectionModel().deselectAll(); if(win.action=='edit'){ record= form.getRecord(); record.set(values); }else{ record=this.getGenericStore().add(values)[0]; } win.close(); }, deleteAction:function(){ var record= this.getGenericlist().getSelectionModel().getLastSelected(); this.getGenericlist().getSelectionModel().deselectAll(); this.getGenericStore().remove(record); } });