Skip to content

Commit

Permalink
Including a few more attributes of Cells. #889
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Aug 1, 2023
1 parent 890bbb7 commit baf78b9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion FetchXmlBuilder/Views/Cell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ public class Cell
public string Name;
public int Width;
public bool IsHidden;
public bool disableSorting;
public string imageproviderwebresource;
public string imageproviderfunctionname;
public TreeNode Attribute;
public LayoutXML Parent;

Expand All @@ -28,9 +31,12 @@ internal Cell(LayoutXML layoutxml, XmlNode cell)
}
IsHidden = ishiddenstr == "1" || ishiddenstr == "true" || width == 0;
Width = IsHidden ? 0 : width;
bool.TryParse(cell.AttributeValue("disableSorting").Replace("1", "True").Replace("0", "False"), out disableSorting);
imageproviderfunctionname = cell.AttributeValue("imageproviderfunctionname");
imageproviderwebresource = cell.AttributeValue("imageproviderwebresource");
}

public override string ToString() => $"{Name} ({Width})";
public override string ToString() => $"{Name} ({(IsHidden ? "Hidden" : Width.ToString())})";

public string ToXML()
{
Expand All @@ -43,6 +49,18 @@ public string ToXML()
{
result += $"width='{Width}' ";
}
if (disableSorting)
{
result += "disableSorting='1' ";
}
if (!string.IsNullOrWhiteSpace(imageproviderfunctionname))
{
result += $"imageproviderfunctionname='{imageproviderfunctionname}' ";
}
if (!string.IsNullOrWhiteSpace(imageproviderwebresource))
{
result += $"imageproviderwebresource='{imageproviderwebresource}' ";
}
result += "/>";
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion FetchXmlBuilder/Views/LayoutXML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public string ToXML()
{
var result = $@"<grid name='resultset' object='{EntityMeta?.ObjectTypeCode}' jump='{EntityMeta?.PrimaryNameAttribute}' select='1' icon='1' preview='1'>
<row name='result' id='{EntityMeta?.PrimaryIdAttribute}'>
{string.Join("\n ", Cells?./*Where(c => c.Width > 0).*/Select(c => c.ToXML()))}
{string.Join("\n ", Cells?.Select(c => c.ToXML()))}
</row>
</grid>";
return result;
Expand Down

0 comments on commit baf78b9

Please sign in to comment.