首页 > javascript如何让这个保存按钮失效?

javascript如何让这个保存按钮失效?

让它在点击“放大镜”的时候,保存按钮失效,点击“本子”的时候可以保存。
《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《
{
xtype:'gridcolumn',
header:'操作',
width:60,
sortable:true,
renderer:function (value, metadata, record, rowIndex, colIndex, store) {

   return "<div width='30' align='center'><a href=javascript:edit_window(" + rowIndex + ")><img src='" + _root + "/res/img/biaoji/edit.png' title='编辑'/><a href=javascript:view_window(" + rowIndex + ")><img src='" + _root + "/res/img/biaoji/lookup.png' title='查看'/></a></div>";

}
},
《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《
function view_window(){
var rec = sw_editorgridpanelUiIns.getSelectionModel().getSelected();
windowUiIns = new windowUi();
windowUiIns.show();
Ext.getCmp('dbid').setValue(rec.get('dbid'));
Ext.getCmp('code').setValue(rec.get('code'));
Ext.getCmp('name').setValue(rec.get('name'));
Ext.getCmp('count_student').setValue(rec.get('count_student'));
Ext.getCmp('teacher_name').setValue(rec.get('teacher_name'));
Ext.getCmp('staff_name').setValue(rec.get('staff_name'));
Ext.getCmp('create_date').setValue(rec.get('create_date'));
setReadOnlyWithCss(['code', 'name', 'count_student', 'teacher_name'],true)
}
《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《
{

                xtype:'button',
                text:'保存',
                iconCls:'save',
                handler:function (){
                    win_save();
                }
                《《《《《《《《《《《《《《《《《《《《《《《《《《,

function win_save(){

var dbid = Ext.getCmp('dbid').getValue();
var code = Ext.getCmp('code').getValue();
var name = Ext.getCmp('name').getValue();
var count_student = Ext.getCmp('count_student').getValue();
var teacher_name = Ext.getCmp('teacher_name').getValue();
Ext.Ajax.request({
    'url':hdmp.root+'/process/test_sw?method=save_win' ,
    params: {
        dbid:dbid,
        code:code,
        name:name,
        count_student:count_student,
        teacher_name:teacher_name
    },
    method:'post',
    waitTitle:'提示',
    waitMsg:'正在提交数据',
    business:function(meg) {
        Ext.Msg.alert('提示', '保存成功!', function(id) {
            windowUiIns.close();
            query_sw();
        });
    },
    success:ajaxRequestSuccess,
    failure:requestError
});

}


用一个变量记录 打开这个页面 时是点击的本子还是放大镜, 然后点击保存的时候判断此变量,是放大镜就return false。 这个跟javascript无关吧,是思路的问题。


Ext.jsButton提供了disabled属性和setDisabled方法可以帮你灵活的控制button的状态,
看文档:Ext.button

【热门文章】
【热门文章】