updateSelectStatus method
void
updateSelectStatus()
Implementation
void updateSelectStatus(bool checkValue, dynamic sourceModel,
dynamic destinationModel, List<dynamic> fields) {
var dynSourcePK = Db().getPrimaryKeyValue(sourceModel);
//var destinationModel = this.model;
var _destinationModel = Dynamic(destinationModel).createInstance();
fields.forEach((fieldName) {
Dynamic(_destinationModel)
.set(fieldName, Dynamic(sourceModel).get(fieldName)!);
});
Dynamic(sourceModel).set('IsActive', checkValue ? 0 : 1);
if (checkValue) {
mapMultiCheck[dynSourcePK] = _destinationModel;
} else {
mapMultiCheck.remove(dynSourcePK);
}
//modelList.clear();
mapMultiCheck.forEach((key, value) {
modelList!
..removeWhere((element) =>
Dynamic(element!).get(fields.first.toString()) ==
Dynamic(value).get(fields.first.toString()));
modelList!.add(value);
});
if (onFilter != null) onFilter!();
DialogRF.refresh();
}