Sha256: 90330e62314b1a7ba3588696a99f2126facc7466d83f47f48bb501ceb501a326

Contents?: true

Size: 1.87 KB

Versions: 3

Compression:

Stored size: 1.87 KB

Contents

Ext.define('FastUI.view.VCustomForm', {
    extend:'Ext.Panel',

    successText:'Success',
    failureText:'Failed',
    invalidText:'Invalid',

    tab:{},
    url: 'fastui',
    method: 'POST',
    autoEl: {tag: 'form'},
    title:'Custom Form',
    bodyPadding:5,
    layout:'anchor',
    border:false,
    html:'<input name="s11" /> <input name="g22" />',

    initComponent:function () {
        this.title = this.getValue('title');
        this.callParent();
    },
    getValue:function(key){
        return this.tab.valueObject[key];
    },
    getMEntity:function(){
        return this.tab.valueObject.entity;
    },
    cmdEdit: function () {
        var id = this.tab.getVGrid().selectedId();
        this.url = this.tab.rest.updatePath(id);
        this.method = 'PUT';
        Ext.Ajax.request({
            url: this.tab.rest.editPath(id),
            success: function (response) {
                var data = Ext.decode(response.responseText);
                this.setValues(data);
            },
            failure: function () {
                Ext.MessageBox.alert(this.failureText, "操作失败!")
            },
            scope: this
        });
    },
    cmdCreate:function(){
        this.url = this.tab.rest.createPath();
        this.method = 'POST';
        this.getEl().dom.reset();
    },
    cmdSave:function(){
        Ext.Ajax.request( {
            url : this.url,
            method : this.method,
            form : this.id,
            success: function () {
                this.tab.vgrid.refresh();
                Ext.MessageBox.alert(this.successText, "操作成功!")
            },
            failure: function () {
                Ext.MessageBox.alert(this.failureText, "操作失败!")
            },
            scope: this
        });
    },
    setValues: function (opt) {

    }

});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fastui-0.1.8 app/assets/javascripts/fastui/app/view/VCustomForm.js
fastui-0.1.7 app/assets/javascripts/fastui/app/view/VCustomForm.js
fastui-0.1.6 app/assets/javascripts/fastui/app/view/VCustomForm.js