[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);
})
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。