I have to use a text box as a custom control editor for FilterRow
of a Janus GridEX
so that I can handle its TextChanged
event and do some asynchronous stuff while maintaining the focus on the current cell.
Here's the code :
gridEX1.RootTable.Columns.Cast<GridEXColumn>().Where(x=>x.Visible).ToList().ForEach(x=>x.EditType=EditType.Custom);
gridEX1.InitCustomEdit += GridEX1_InitCustomEdit;
gridEX1.EndCustomEdit += GridEX1_EndCustomEdit;
and
private void GridEX1_InitCustomEdit(object sender, InitCustomEditEventArgs e)
{
txt.TextChanged -= TxtOnTextChanged;
txt.Text = e.Value?.ToString()+e.EditChar;
e.EditControl = txt;
txt.TextChanged += TxtOnTextChanged;
}
private void GridEX1_EndCustomEdit(object sender, EndCustomEditEventArgs e)
{
e.Value = txt.Text;
}
Everything is working fine except that hitting BackSapce
on filter row doesn't put the cell in edit mode ( InitCustomEdit
does not fire)
Any idea how should I solve this problem ?