[King.yue]Grid列选中JS控制按钮状态

Grid列选中一行某些按钮启用

例:gridId(Grid   ID)

  btnEditId(编辑按钮ID)

  btnDeleteId(删除按钮ID)

JS:

var setButtonStatus = function (gridId, btnEditId, btnDeleteId) {
var gridView = Ext.getCmp(gridId).getSelectionModel(); //获取Grid列选中状态
if (gridView.hasSelection()) {
if (typeof (Ext.getCmp(btnEditId)) != ‘undefined‘)    //判断控件状态
Ext.getCmp(btnEditId).setDisabled(false);        //设置控件显示
if (typeof (Ext.getCmp(btnDeleteId)) != ‘undefined‘)
Ext.getCmp(btnDeleteId).setDisabled(false);
}
else {
if (typeof (Ext.getCmp(btnEditId)) != ‘undefined‘)
Ext.getCmp(btnEditId).setDisabled(true);
if (typeof (Ext.getCmp(btnDeleteId)) != ‘undefined‘)
Ext.getCmp(btnDeleteId).setDisabled(true);
}
}

调用:

item.Add(Html.Y().Grid(Model.GridId, Model.StoreId)
.Listeners(l =>
{
l.SelectionChange.Handler += string.Format(@"setButtonStatus(‘{0}‘,‘{1}‘,‘{2}‘)"
, Model.GridId, vm.BTN_HBOOK_ITEM_EDIT, vm.BTN_HBOOK_ITEM_DELETE);
})

[King.yue]Grid列选中JS控制按钮状态,布布扣,bubuko.com

[King.yue]Grid列选中JS控制按钮状态

上一篇:jQuery无限载入瀑布流 【转载】


下一篇:mysql怎么打开啊?