Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: First grid column was not visible #1246

Merged
merged 2 commits into from Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -243,6 +243,7 @@ public class AsPanelBuilder
idPropertyElement.SetAttribute("Name", primaryKeyColumnName);
idPropertyElement.SetAttribute("Entity", "String");
idPropertyElement.SetAttribute("Column", "Text");
idPropertyElement.SetAttribute("AlwaysHidden", "true");

XmlElement formRootElement = parentNode.OwnerDocument.CreateElement("FormRoot");
formRootElement.SetAttribute("Type", "Canvas");
Expand Down
Expand Up @@ -1786,7 +1786,12 @@ private static void SetUserConfig(XmlDocument doc, XmlNode parentNode, string de
.ExtendedProperties["OrigamDataType"]));
break;
}

// The Id column was created earlier in AsPanelBuilder.cs
// and is meant to be invisible.
// If the Id column was added to the model in the Architect
// and thus should be the invisible, the original invisible
// Id column is removed. Duplicated Id column would create
// problems in the client
XmlElement zeroColumn = propertiesElement.FirstChild as XmlElement;
if(propertyElement.GetAttribute("Id") == zeroColumn.GetAttribute("Id"))
{
Expand Down
Expand Up @@ -37,7 +37,7 @@ export function saveColumnConfigurations(ctx: any) {
}

const activeTableConfiguration = configurationManager.activeTableConfiguration;
for (const property of getProperties(ctx)) {
for (const property of getProperties(ctx).slice(1)) {
activeTableConfiguration.updateColumnWidth(property.id, property.columnWidth);
}
activeTableConfiguration.sortColumnConfigurations(tablePanelView.tablePropertyIds);
Expand Down
1 change: 1 addition & 0 deletions frontend-html/src/model/entities/Property.ts
Expand Up @@ -83,6 +83,7 @@ export class Property implements IProperty {
linkDependsOnValue: boolean = false;
fieldType: string = null as any;
isFormField: boolean = false;
alwaysHidden: boolean = false;

get isLookup() {
return !!this.lookup;
Expand Down
2 changes: 2 additions & 0 deletions frontend-html/src/model/entities/types/IProperty.ts
Expand Up @@ -43,6 +43,7 @@ export interface IPropertyData {
column: IPropertyColumn;
dock?: IDockType;
multiline: boolean;
alwaysHidden: boolean;
isPassword: boolean;
isRichText: boolean;
maxLength: number;
Expand Down Expand Up @@ -77,6 +78,7 @@ export interface IProperty extends IPropertyData {
dataSourceIndex: number;
dataIndex: number;
isLookup: boolean;
alwaysHidden: boolean;
lookupEngine?: ILookupIndividualEngine;

childProperties: IProperty[];
Expand Down
113 changes: 58 additions & 55 deletions frontend-html/src/xmlInterpreters/screenXml.ts
Expand Up @@ -117,56 +117,57 @@ export function fixColumnWidth(width: number) {
}
}

function parseProperty(property: any, idx: number): IProperty {
function parseProperty(node: any, idx: number): IProperty {
const propertyObject = new Property({
xmlNode: property,
id: property.attributes.Id,
tabIndex: property.attributes.TabIndex,
controlPropertyId: property.attributes.ControlPropertyId,
controlPropertyValue: property.attributes.ControlPropertyValue,
modelInstanceId: property.attributes.ModelInstanceId || "",
name: property.attributes.Name,
readOnly: property.attributes.ReadOnly === "true",
x: parseInt(property.attributes.X, 10),
y: parseInt(property.attributes.Y, 10),
width: parseInt(property.attributes.Width, 10),
height: parseInt(property.attributes.Height, 10),
captionLength: parseInt(property.attributes.CaptionLength, 10),
captionPosition: property.attributes.CaptionPosition,
entity: property.attributes.Entity,
column: property.attributes.Column,
parameters: getPropertyParameters(property),
dock: property.attributes.Dock,
multiline: property.attributes.Multiline === "true",
isPassword: property.attributes.IsPassword === "true",
isRichText: property.attributes.IsRichText === "true",
autoSort: property.attributes.AutoSort === "true",
maxLength: parseInt(property.attributes.MaxLength, 10),
modelFormatterPattern: replaceDefaultDateFormats(property.attributes.FormatterPattern),
formatterPattern: property.attributes.FormatterPattern
? getMomentFormat(property)
xmlNode: node,
id: node.attributes.Id,
tabIndex: node.attributes.TabIndex,
controlPropertyId: node.attributes.ControlPropertyId,
controlPropertyValue: node.attributes.ControlPropertyValue,
modelInstanceId: node.attributes.ModelInstanceId || "",
name: node.attributes.Name,
readOnly: node.attributes.ReadOnly === "true",
x: parseInt(node.attributes.X, 10),
y: parseInt(node.attributes.Y, 10),
width: parseInt(node.attributes.Width, 10),
height: parseInt(node.attributes.Height, 10),
captionLength: parseInt(node.attributes.CaptionLength, 10),
captionPosition: node.attributes.CaptionPosition,
entity: node.attributes.Entity,
column: node.attributes.Column,
alwaysHidden: node.attributes.AlwaysHidden === "true",
parameters: getPropertyParameters(node),
dock: node.attributes.Dock,
multiline: node.attributes.Multiline === "true",
isPassword: node.attributes.IsPassword === "true",
isRichText: node.attributes.IsRichText === "true",
autoSort: node.attributes.AutoSort === "true",
maxLength: parseInt(node.attributes.MaxLength, 10),
modelFormatterPattern: replaceDefaultDateFormats(node.attributes.FormatterPattern),
formatterPattern: node.attributes.FormatterPattern
? getMomentFormat(node)
: "",
customNumericFormat: property.attributes.CustomNumericFormat,
identifier: property.attributes.Identifier,
gridColumnWidth: property.attributes.GridColumnWidth
? parseInt(property.attributes.GridColumnWidth)
customNumericFormat: node.attributes.CustomNumericFormat,
identifier: node.attributes.Identifier,
gridColumnWidth: node.attributes.GridColumnWidth
? parseInt(node.attributes.GridColumnWidth)
: 100,
columnWidth: fixColumnWidth(
property.attributes.GridColumnWidth ? parseInt(property.attributes.GridColumnWidth) : 100
node.attributes.GridColumnWidth ? parseInt(node.attributes.GridColumnWidth) : 100
),
suppressEmptyColumns: property.attributes.SuppressEmptyColumns === "true",
lookupId: property.attributes.LookupId,
lookup: !property.attributes.LookupId
suppressEmptyColumns: node.attributes.SuppressEmptyColumns === "true",
lookupId: node.attributes.LookupId,
lookup: !node.attributes.LookupId
? undefined
: new Lookup({
dropDownShowUniqueValues: property.attributes.DropDownShowUniqueValues === "true",
lookupId: property.attributes.LookupId,
identifier: property.attributes.Identifier,
identifierIndex: parseInt(property.attributes.IdentifierIndex, 10),
dropDownType: property.attributes.DropDownType,
cached: property.attributes.Cached === "true",
searchByFirstColumnOnly: property.attributes.SearchByFirstColumnOnly === "true",
dropDownColumns: findStopping(property, (n) => n.name === "Property").map(
dropDownShowUniqueValues: node.attributes.DropDownShowUniqueValues === "true",
lookupId: node.attributes.LookupId,
identifier: node.attributes.Identifier,
identifierIndex: parseInt(node.attributes.IdentifierIndex, 10),
dropDownType: node.attributes.DropDownType,
cached: node.attributes.Cached === "true",
searchByFirstColumnOnly: node.attributes.SearchByFirstColumnOnly === "true",
dropDownColumns: findStopping(node, (n) => n.name === "Property").map(
(ddProperty) => {
return new DropDownColumn({
id: ddProperty.attributes.Id,
Expand All @@ -178,7 +179,7 @@ function parseProperty(property: any, idx: number): IProperty {
}
),
dropDownParameters: findStopping(
property,
node,
(n) => n.name === "ComboBoxParameterMapping"
).map((ddParam) => {
return {
Expand All @@ -188,17 +189,17 @@ function parseProperty(property: any, idx: number): IProperty {
}),
}),

allowReturnToForm: property.attributes.AllowReturnToForm === "true",
isTree: property.attributes.IsTree === "true",
isAggregatedColumn: property.attributes.Aggregated || false,
isLookupColumn: property.attributes.IsLookupColumn || false,
style: cssString2Object(property.attributes.Style),
toolTip: property.elements.find((child: any) => child.name === "ToolTip")?.elements?.[0]?.text,
supportsServerSideSorting: property.attributes.SupportsServerSideSorting === "true",
fieldType: property.attributes.FieldType
allowReturnToForm: node.attributes.AllowReturnToForm === "true",
isTree: node.attributes.IsTree === "true",
isAggregatedColumn: node.attributes.Aggregated || false,
isLookupColumn: node.attributes.IsLookupColumn || false,
style: cssString2Object(node.attributes.Style),
toolTip: node.elements.find((child: any) => child.name === "ToolTip")?.elements?.[0]?.text,
supportsServerSideSorting: node.attributes.SupportsServerSideSorting === "true",
fieldType: node.attributes.FieldType
});
if (property.elements && property.elements.length > 0) {
property.elements
if (node.elements && node.elements.length > 0) {
node.elements
.filter((element: any) => element.name === "Property")
.map((childProperty: any, idx: number) => parseProperty(childProperty, idx))
.forEach((childProperty: IProperty) => {
Expand Down Expand Up @@ -440,7 +441,9 @@ export function*interpretScreenXml(
serverSideGrouper: new ServerSideGrouper(),
lifecycle: new DataViewLifecycle(),
tablePanelView: new TablePanelView({
tablePropertyIds: properties.slice(1).map((prop) => prop.id),
tablePropertyIds: properties
.filter(x => !x.alwaysHidden)
.map((prop) => prop.id),
columnConfigurationModel: new ColumnConfigurationModel(),
filterConfiguration: filterConfiguration,
filterGroupManager: filterGroupManager,
Expand Down