This commit is contained in:
2020-03-13 19:43:27 +00:00
parent 02cdaa1346
commit 6ea38ba347
3 changed files with 17 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ namespace AyaNova.PickList
//MUST be present in all datalists and displayed at the client
public bool IsRowId { get; set; }
public bool IsActiveColumn { get; set; }
//CLIENT / SERVER - client display and to indicate what object to open , Server for formatting return object
public int AyaObjectType { get; set; }
@@ -60,6 +61,7 @@ namespace AyaNova.PickList
IsFilterable = true;
IsSortable = true;
IsRowId = false;
IsActiveColumn=false;
//Set openable object type to no type which is the default and means it's not a link to another object
AyaObjectType = (int)AyaType.NoType;

View File

@@ -36,8 +36,21 @@ namespace AyaNova.PickList
//Add rowid column as it's always required
AyaPickListFieldDefinition rowIdColumn = pickList.ColumnDefinitions.FirstOrDefault(x => x.IsRowId == true);
//this should only happen with a development error
if (rowIdColumn == null)
throw new System.ArgumentNullException($"DEV ERROR in PickListSqlBuilder.cs: picklist for {pickList.DefaultListObjectType.ToString()} has no rowId column specified in columnDefinitions list");
lSelect.Add(rowIdColumn.SqlIdColumnName + " AS rowid");
//add active only as default for all lists unless inactive is specified
if (!IncludeInactive)
{
AyaPickListFieldDefinition activeColumn = pickList.ColumnDefinitions.FirstOrDefault(x => x.IsActiveColumn == true);
//it's ok if there is no active column, it could happen so just roll with it
if(activeColumn!=null){
lWhere.Add(activeColumn.SqlValueColumnName + " = true");
}
}
foreach (string ColumnName in templateColumnNames)
{

View File

@@ -38,7 +38,8 @@ namespace AyaNova.PickList
LtKey = "Active",
FieldKey = "widgetactive",
UiFieldDataType = (int)UiFieldDataType.Bool,
SqlValueColumnName = "awidget.active"
SqlValueColumnName = "awidget.active",
IsActiveColumn = true
});
ColumnDefinitions.Add(new AyaPickListFieldDefinition