Posted 25 June 2018, 2:20 am EST
The problem is that the highlighting of the text within the cells is happening, but the filtering itself of the rows doesn’t happen.
Row view model:
public class ProgressScheduleRowViewModel : ViewModel
{
public int RowRecordId { get; set; }
public List<ProgressScheduleInfoCellViewModel> InfoCells { get; set; }
public List<ProgressScheduleStepCellViewModel> StepCells { get; set; }
}
Grid configuration:
ProgressScheduleFlexGrid.AutoGenerateColumns = false;
ProgressScheduleFlexGrid.ItemsSource = new C1FilterCollectionView<ProgressScheduleRowViewModel>(ViewModel.Rows);
Full text filter configuration:
FullTextFilterBehavior fullTextFilterBehavior = new FullTextFilterBehavior();
fullTextFilterBehavior.Attach(ProgressScheduleFlexGrid);
fullTextFilterBehavior.FilterEntry = FilterTextField;
fullTextFilterBehavior.HighlightColor = _fullTextFilterSelectedTextColor;
fullTextFilterBehavior.MatchNumbers = true;
fullTextFilterBehavior.Mode = FullTextFilterMode.WhileTyping;
fullTextFilterBehavior.TreatSpacesAsAndOperator = true;
Custom column addition:
private void ConfigureFlexGridRecordIdInfoColumn(ProgressScheduleInfoColumnViewModel recordIdInfoColumnViewModel)
{
GridColumn recordIdInfoColumn = new ProgressScheduleRecordIdInfoColumn();
ConfigureFlexGridColumn(ref recordIdInfoColumn, recordIdInfoColumnViewModel.Name, recordIdInfoColumnViewModel.Name, 100);
}
private void ConfigureFlexGridColumn(ref GridColumn gridColumn, string columnName, string columnHeader, GridLength width)
{
gridColumn.ColumnName = columnName;
gridColumn.Header = columnHeader;
gridColumn.HeaderHorizontalAlignment = UIControlContentHorizontalAlignment.Center;
gridColumn.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
gridColumn.IsVisible = true;
gridColumn.Width = width;
ProgressScheduleFlexGrid.Columns.Add(gridColumn);
}
Custom column definition:
public class ProgressScheduleRecordIdInfoColumn : GridColumn
{
private const int _space = 5;
protected override void BindCellContent(UIView cellContent, GridCellType cellType, GridRow row)
{
if (cellType == GridCellType.Cell)
{
UILabel recordIdInfoCellContent = cellContent as UILabel;
recordIdInfoCellContent.Text = GetCellText(cellType, row);
}
else
{
base.BindCellContent(cellContent, cellType, row);
}
}
protected override UIView CreateCellContent(GridCellType cellType, object cellContentType, GridRow row)
{
if (cellType == GridCellType.Cell)
{
UILabel recordIdInfoCellContent = new UILabel();
return recordIdInfoCellContent;
}
else
{
return base.CreateCellContent(cellType, cellContentType, row);
}
}
protected override object GetCellContentType(GridCellType cellType, GridRow row)
{
if (cellType == GridCellType.Cell)
{
return typeof(UILabel);
}
else
{
return base.GetCellContentType(cellType, row);
}
}
public override string GetCellText(GridCellType cellType, GridRow row)
{
if (cellType == GridCellType.Cell)
{
ProgressScheduleRowViewModel rowViewModel = row.DataItem as ProgressScheduleRowViewModel;
return rowViewModel.InfoCells[0].Value;
}
else
{
return base.GetCellText(cellType, row);
}
}
public override object GetCellValue(GridCellType cellType, GridRow row)
{
if (cellType == GridCellType.Cell)
{
ProgressScheduleRowViewModel rowViewModel = row.DataItem as ProgressScheduleRowViewModel;
return rowViewModel.RowRecordId;
}
else
{
return base.GetCellValue(cellType, row);
}
}
protected override void PrepareCell(GridCellType cellType, GridRow row, GridCellView cell)
{
if (cellType == GridCellType.Cell)
{
cell.Padding = new UIEdgeInsets(_space, _space, _space, _space);
UILabel recordIdInfoCellContent = cell.Content as UILabel;
recordIdInfoCellContent.TextAlignment = UITextAlignment.Left;
}
else
{
base.PrepareCell(cellType, row, cell);
}
}
}
How does the filtering of the rows happen?