May 02, 2018, 4:00 PM
How to disable/enable button based on a value in the grid cell ?
I use Ext.net iIn my Index.cshtml page.
I have a grid and a button called BtnEdit in my page.
One of the columns in the grid is called "Match".
I would like to disable BtnEdit when "Match" = "N", and enable it when "Match" = "Y" .
How can I do that ?
Thank you.
This is a snippet of my code:
I have a grid and a button called BtnEdit in my page.
One of the columns in the grid is called "Match".
I would like to disable BtnEdit when "Match" = "N", and enable it when "Match" = "Y" .
How can I do that ?
Thank you.
This is a snippet of my code:
@(X.Viewport().Layout(LayoutType.Fit)
.Items(
X.GridPanel().ID("GridPanel1").MarginSpec("1 1 1 1").Cls("cust-grid")
.ColumnModel(
X.RowNumbererColumn().Width(35).Sortable(false).Hideable(false),
X.NumberColumn().Text("ID").DataIndex("ID").Width(80).Format("#").Align(Alignment.Right).Hideable(false).Groupable(false).Filter(X.NumberFilter()),
X.Column().Text("Match").ID("Match").DataIndex("Match").Width(85).Align(Alignment.Center).Hideable(false).Groupable(false).Filter(X.ListFilter().Options("Y,N")),
)
.Listeners(ls => ls.Select.Handler = @"var store=App.Store1; var combo=App.NoItem; store.pageSize=combo.getValue(); store.reload();")
.Plugins(X.GridFilters())
.View(X.GridView().StripeRows(true).TrackOver(false).GetRowClass(r=>r.Fn="getRowClass"))
.SelectionModel(X.RowSelectionModel().Mode(SelectionMode.Single))
.TopBar(
X.Toolbar().ID("Toolbar1").MinHeight(35)
.Items(
X.Button().ID("BtnEdit")
.Text("Edit").Icon(Icon.GroupEdit)
.Handler("var rec=App.GridPanel1.selModel.getSelection()[0]; if(rec) { App.Form1.getForm().loadRecord(rec); App.WindowEdit.show(this);} else alert('Please select row first!')")
Last edited by faujong; May 02, 2018 at 4:14 PM.