PDA

View Full Version : [CLOSED] DisplayField with multiple fields



Patrick_G
Jan 30, 2013, 9:57 PM
Hello

We set up a read only form to display customer information like this using DisplayFields:

Name: Joe
Address: 1234 Main
City: Portland
State: OR
Zip: 98000



<ext:DisplayField ID="CustomerName" runat="server" FieldLabel="Name" LabelAlign="Right"/>
<ext:DisplayField ID="CustomerNumber" runat="server" FieldLabel="Number" LabelAlign="Right"/>
<ext:DisplayField ID="Address" runat="server" FieldLabel="Address" LabelAlign="Right"/>
<ext:DisplayField ID="City" runat="server" FieldLabel="City" LabelAlign="Right"/>
<ext:DisplayField ID="State" runat="server" FieldLabel="State" LabelAlign="Right"/>
<ext:DisplayField ID="Zip" runat="server" FieldLabel="Zip" LabelAlign="Right"/>

But we want to display it like this
Name: Joe
Address: 1234 Main Portland, OR 98000

What object type should I use for accomplishing this and do you have a link to an example that combines multiple fields into one?

Thank you for your help.

Baidaly
Jan 30, 2013, 11:14 PM
Hello!

Try to use FieldContainer: http://examples2.ext.net/#/Form/FieldContainer/Overview/

Patrick_G
Feb 01, 2013, 9:32 AM
Thank you Baidaly for responding so quickly! I had seen that example but wasnt sure if it would help. I dug in a bit deeper after your suggestion and got it work. However, the combined text does not line up "quite" right like it does for the other fields where I am only using one value. Also, sometimes, sporadically, the text would all pile on top of each other rather than display as a single string.

I went with returning an additional field from our model that has all the fields combined into a single field.

Thank you again for your help.

Daniil
Feb 01, 2013, 11:42 AM
If you will have a chance and time to provide us with a sample to reproduce the issue you are talking about, we would be happy to investigate.

Patrick_G
Feb 01, 2013, 9:32 PM
Hello Danil, below is an example:
Two things occur
1) The text next to Address is lower relative to its label than Cust Number and Email are relative to their labels. I can almost fix it playing around with MarginSpecs and such but only get it close to the same alignment as Email Address and Cust Number.
2) The text for Address is collapsed on top of each other.

Note: I tested this in IE, FF, Chrome



<%@ Page Language="C#" %>
<%@ Import Namespace="System.Collections.Generic"%>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
FormPanel2.SetValues(new {
Email = "henry@example.com",
FirstName = "Henry",
LastName = "Example",
CustNumber = "6755499",
Address = "1234 Main",
City = "Portland",
State = "OR",
Zip = "90000",
});
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:FormPanel
ID="FormPanel2" runat="server">
<Items>
<ext:DisplayField ID="TextField18"
runat="server"
Name="Email"
FieldLabel="Email Address"
LabelAlign="Right"/>
<ext:DisplayField ID="DisplayField1"
runat="server"
Name="CustNumber"
FieldLabel="Cust Number"
LabelAlign="Right"/>
<ext:FieldContainer ID="FieldContainer1" runat="server" CombineErrors="true" MsgTarget="Under" Layout="HBoxLayout" FieldLabel="Address" LabelAlign="Right" >
<Defaults>
<ext:Parameter Name="HideLabel" Value="true" Mode="Raw" />
<ext:Parameter Name="margins" Value="0 5 0 0" Mode="Value" />
</Defaults>
<Items>
<ext:DisplayField ID="Address" runat="server" />
<ext:DisplayField ID="DisplayField2" runat="server" Text="&nbsp;" />
<ext:DisplayField ID="City" runat="server" />
<ext:DisplayField ID="DisplayField3" runat="server" Text=",&nbsp;" />
<ext:DisplayField ID="State" runat="server" />
<ext:DisplayField ID="DisplayField4" runat="server" Text="&nbsp;" />
<ext:DisplayField ID="Zip" runat="server" />
</Items>
</ext:FieldContainer>
</Items>
</ext:FormPanel>
</body>
</html>

Baidaly
Feb 01, 2013, 11:03 PM
Hello!

Sorry, I didn't see anything wrong in your example. I've tried with the last trunk revision.

5535