custom state grid populates with first child row that has params (if selected row doesn't have any itself)

This commit is contained in:
John Colvin committed 2020-04-23 15:59:49 -05:00
1 parent df56b76ab6
commit 87c9f54c8b
1 file changed
+14 -1
@@ -200,7 +200,20 @@ namespace mbts.spark {
void refresh_custom_state() {
current_algo_custom_state.Clear();
foreach (var p in r.order.dynamic_custom_state())
var dcs = r.order.dynamic_custom_state();
// while dcs is not expected to be null, best to play it safe and double check.
if (dcs.is_null_or_empty()) {
var child_rows = _row_collection.get_descendent_rows(r.order_key);
if (_row_collection.filter != null) {
child_rows = child_rows.Where(cr => _row_collection.filter(cr.order_tuple));
}
foreach (var dr in child_rows) {
dcs = dr.order.dynamic_custom_state();
if (!dcs.is_null_or_empty())
break;
}
}
foreach (var p in dcs.empty_if_null())
current_algo_custom_state.Add(new NamedValueVM(p.Key, DynamicOrderHelper.fmt_param(p.Value)));
}
}),