Sha256: a955c22b309819a5a73118924f546f7d8bd7f3f1cd67bd8937565bafdcb9bb49

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

Ext.define('TM.controller.Tasks', {
	extend: 'Ext.app.Controller',

	views: ['task.Index'],

	refs: [{
		ref: 'searchForm',
		selector: 'task_search'
	}],

	init: function() {
		this.control({
		  'task_search button[action="query"]': {
		    click: this.onQueryClick
		  },
		  'task_search button[action="reset"]': {
		    click: this.onSearchResetClick
		  },
		  'task_grid button[action="delete"]': {
		    click: this.onDeleteClick
		  }
		});
	},

	onQueryClick: function(btn) {
    var params = this.getSearchForm().getValues();
    Ext.getStore('TM.store.Tasks').load({ params: params });
  },

  onSearchResetClick: function(btn) {
    this.getSearchForm().getForm().reset();
  },

	onDeleteClick: function(btn) {
		var select = btn.up('task_grid').getSelectionModel().getSelection()[0];
    if(select == null) {
      Ext.Msg.alert('提示','请选择要删除的计划任务');
      return;
    }

    Ext.Msg.confirm('提示','您确认要删除选中的计划任务吗?', function(b){
      if(b != 'yes') return;

      var selected = btn.up('task_grid').getSelectionModel().getSelection();
      Ext.each(selected, function(s){
        this.callParent(arguments);

    		if(this.store) this.store.remove(this);
      });
    });
	},

	index: function() {
		this.render('TM.view.task.Index');
	}
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
task-manager-0.1.4 app/assets/javascripts/task-manager/extjs/app/controller/Tasks.js
task-manager-0.1.3 app/assets/javascripts/task-manager/extjs/app/controller/Tasks.js
task-manager-0.1.2 app/assets/javascripts/task-manager/extjs/app/controller/Tasks.js
task-manager-0.1.1 app/assets/javascripts/task-manager/extjs/app/controller/Tasks.js