PDA

View Full Version : [CLOSED] FormPanel renderization bug when LabelAlign and MsgTarget are set



RCN
Apr 17, 2012, 1:54 PM
When button1 is clicked, the data is loaded and the the form renders correctly because the data meets the formīs requirements. basically, the Name field of Form does not allow blank text and the data loaded has this property filled.

4116

But when i click button2 AFTER clicking button1 the data loaded does not this property filled and the following bug occurs.

4117

it happens because the LabelAlign property is set to Top and MsgTarget property is set to Side

Any ideas to overcome this problem?



<ext:FormPanel ID="FormPanel1" runat="server" Title="Form Panel" Width="300">
<FieldDefaults LabelAlign="Top" MsgTarget="Side" />
<Items>
<ext:TextField Name="ID" FieldLabel="ID" AnchorHorizontal="100%" runat="server" />
<ext:TextField Name="Name" FieldLabel="Name" AllowBlank="false" AnchorHorizontal="100%" runat="server" />
</Items>
<Buttons>
<ext:Button ID="button1" runat="server" Text="Old">
<Listeners>
<Click Handler="loadRecord(false);" />
</Listeners>
</ext:Button>
<ext:Button ID="button2" runat="server" Text="New">
<Listeners>
<Click Handler="loadRecord(true);" />
</Listeners>
</ext:Button>
</Buttons>
<Bin>
<ext:Store ID="Store2" runat="server" AutoLoad="false" PageSize="1">
<Model>
<ext:Model ID="Model2" IDProperty="ID" runat="server">
<Fields>
<ext:ModelField Name="ID" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Bin>
</ext:FormPanel>




<script type="text/javascript">
var loadRecord = function (loadNew) {

Ext.net.DirectMethod.request({
url: "/Example/Test",
cleanRequest: true,
params: {
loadNew: loadNew
},
success: function (result) {
App.Store2.loadRawData(result);

var record = App.Store2.getAt(0);

App.FormPanel1.getForm().loadRecord(record);
}
});
}
</script>




public AjaxResult Test(bool loadNew)
{
AjaxResult ajx = new AjaxResult();

if (loadNew)
{
ajx.Result = new Person();
}
else
{
ajx.Result = new Person { ID = 1, Name = "EXT"};
}

return ajx;
}

Daniil
Apr 17, 2012, 4:16 PM
Hi,

Please try to call the doLayout method after loading a record.


App.FormPanel1.getForm().loadRecord(record);
App.FormPanel1.doLayout();

RCN
Apr 17, 2012, 5:55 PM
Unfortunately it does not work even if doLayout method is called.

Daniil
Apr 17, 2012, 6:02 PM
We are unable to reproduce the problem using the following example.

Is it reproducible on your side?

Do you use the last Ext.NET sources from SVN?

What browser do you test with?

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Examples</title>

<script type="text/javascript">
var loadRecord = function (loadNew) {
if (loadNew) {
App.FormPanel1.getForm().setValues({ Name : "", ID : 0 });
} else {
App.FormPanel1.getForm().setValues({ Name : "EXT", ID : 1 });
}
}
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:FormPanel
ID="FormPanel1"
runat="server"
Title="Form Panel"
Width="300">
<FieldDefaults LabelAlign="Top" MsgTarget="Side" />
<Items>
<ext:TextField
runat="server"
Name="ID"
FieldLabel="ID"
AnchorHorizontal="100%" />
<ext:TextField
runat="server"
Name="Name"
FieldLabel="Name"
AllowBlank="false"
AnchorHorizontal="100%" />
</Items>
<Buttons>
<ext:Button runat="server" Text="Old">
<Listeners>
<Click Handler="loadRecord(false);" />
</Listeners>
</ext:Button>
<ext:Button runat="server" Text="New">
<Listeners>
<Click Handler="loadRecord(true);" />
</Listeners>
</ext:Button>
</Buttons>
</ext:FormPanel>
</form>
</body>
</html>

RCN
Apr 17, 2012, 6:11 PM
I tested on IE 8.0.7600.16385. After you post i tested it on Chrome and it worked. Is the version 8.0 of IE supported?

Daniil
Apr 18, 2012, 10:26 AM
Yes, IE8 is still supported.

I've reproduced the problem in IE8. We will investigate a possible fix.

RCN
Apr 18, 2012, 12:46 PM
Thank you Daniil

Daniil
Apr 18, 2012, 4:19 PM
The fix has been added to SVN, please update.