I have a relatively simple form, it has a start date control and end date control that users can modify and it needs to update the grid filter based on those values.

Form class:
[DataSource]
class griddata
{
/// <summary>
///
/// </summary>
public void executeQuery()
{
QueryBuildRange qbr;
qbr = this.query().dataSourceTable(tableNum(griddata)).addRange(fieldNum(griddata, ModifiedOn));
var startDate = StartDateControl.dateValue();
var endDate = DateTimeUtil::date(DateTimeUtil::addDays(EndDateControl.dateValue(), 1));
qbr.value(SysQuery::range(startDate, endDate));
super();
}
/// <summary>
///
/// </summary>
public void init()
{
super();
this.query().dataSourceTable(tableNum(griddata)).addSortField(fieldNum(griddata, ModifiedOn), SortOrder::Descending);
}
/// <summary>
///
/// </summary>
/// <param name = "_retainPosition"></param>
public void research(boolean _retainPosition = false)
{
griddata_ds.executeQuery();
super(_retainPosition);
}
}
Event handlers:
[FormControlEventHandler(formControlStr(MyForm, StartDateControl), FormControlEventType::Modified)]
public static void StartDateControl_OnModified(FormControl sender, FormControlEventArgs e)
{
var ds = sender.formRun().dataSource("griddata");
ds.research();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(MyForm, EndDateControl), FormControlEventType::Modified)]
public static void EndDateControl_OnModified(FormControl sender, FormControlEventArgs e)
{
var ds = sender.formRun().dataSource("griddata");
ds.research();
}
I am having an issue that the grid correctly loads the filters and sorting correctly at the initial launch. But it does not update the grid once either of the start date or end date are updated.
1) Is this the correct idea on how to handle this?
2) What else do I need to do to make the grid values update based on the user input?
*This post is locked for comments
I have the same question (0)