PDA

View Full Version : [CLOSED] Hidden with Region None with TreePanel



softmachine2011
Sep 13, 2012, 11:03 AM
Hi,

I'm having a rendering problem that I don't know if is it cause of bad design or an issue.

I have a BorderLayout with a TreePanel and two hiddens. Treepanel has region Center and Hidden Region none. Rendered in a simple page works fine, but rendered as a partial view doesn't draw anything, it seems that crash.

TEST CASE

CONTROLLER

public ActionResult MyPartialView(string containerId)
{
Ext.Net.MVC.PartialViewResult r = new Ext.Net.MVC.PartialViewResult(containerId, Ext.Net.RenderMode.AddTo);
r.SingleControl = true;
r.WrapByScriptTag = false;
return r;
}

MAIN ASPX

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<ext:Window ID="myWindow" runat="server">
<Loader runat="server" Url="/Area/Sample/MyPartialView" Mode="Script">
<Params>
<ext:Parameter Name="containerId" Value="myWindow" mode="Value" />
</Params>
</Loader>
</ext:Window>
</body>
</html>

PARTIAL VIEW

<ext:Panel ID="pnlElementos" runat="server" Border="false" Height="500" Layout="BorderLayout">
<Items>
<ext:TreePanel ID="TreePanel1" runat="server" Title="My Task List" Icon="Accept"
Height="400" Width="250" UseArrows="true" AutoScroll="true" Animate="true" EnableDD="true"
ContainerScroll="true" RootVisible="false" Region="Center">
<Root>
<ext:Node>
<Children>
<ext:Node Text="To Do" Icon="Folder">
<Children>
<ext:Node Text="Go jogging" Leaf="true" Checked="False" />
<ext:Node Text="Take a nap" Leaf="true" Checked="False" />
<ext:Node Text="Clean house" Leaf="true" Checked="False" />
</Children>
</ext:Node>
<ext:Node Text="Grocery List" Icon="Folder">
<Children>
<ext:Node Text="Bananas" Leaf="true" Checked="False" />
<ext:Node Text="Milk" Leaf="true" Checked="False" />
<ext:Node Text="Cereal" Leaf="true" Checked="False" />
<ext:Node Text="Energy foods" Icon="Folder">
<Children>
<ext:Node Text="Coffee" Leaf="true" Checked="False" />
<ext:Node Text="Red Bull" Leaf="true" Checked="False" />
</Children>
</ext:Node>
</Children>
</ext:Node>
<ext:Node Text="Kitchen Remodel" Icon="Folder">
<Children>
<ext:Node Text="Finish the budget" Leaf="true" Checked="False" />
<ext:Node Text="Call contractors" Leaf="true" Checked="False" />
<ext:Node Text="Choose design" Leaf="true" Checked="False" />
</Children>
</ext:Node>
</Children>
</ext:Node>
</Root>
<Listeners>
<CheckChange Handler="var node = Ext.get(this.getView().getNode(item));
node[checked ? 'addCls' : 'removeCls']('complete')" />
<Render Handler="this.getRootNode().expand(true);" Delay="50" />
</Listeners>
</ext:TreePanel>
<ext:Hidden ID="hCheckedValues" runat="server" Region="None" />
<ext:Hidden ID="RegistroPrevio" runat="server" Region="None" />
</Items>
</ext:Panel>

Possibly it is related with this other thread http://forums.ext.net/showthread.php?20978-RadioGroup-CheckBoxGroup-in-PartialView but right now I haven't updated, I am at revision 4283 because there is an Ext.JS with opened ticket in other thread.

This is a test case, but in my project I reproduce the same and declaring Hidden's in Content of Panel draws well, but in form submit hidden's aren't send, I don't know if this is the normal behaviour or is cause of being inside a partial view. It could be another issue if hiddens have to be sent.

Daniil
Sep 13, 2012, 3:20 PM
Hi,

Thank you for the good sample as usual.

BorderLayout considers all Items as Regions including Hidden fields and yes, it crashes. I am not sure why it is not crashed when used statically. Anyway, it is definitely not supported.

Do you really need BorderLayout here? Could you use FitLayout instead?



This is a test case, but in my project I reproduce the same and declaring Hidden's in Content of Panel draws well, but in form submit hidden's aren't send, I don't know if this is the normal behaviour or is cause of being inside a partial view. It could be another issue if hiddens have to be sent.

Do you mean submitting by calling the submit method of FormPanel? Yes, it submits items only. Content is rendered as raw HTML.

softmachine2011
Sep 14, 2012, 8:33 AM
Hi,

I try to put fitlayout but doesn't draw well and the window seems bugged.

Also I try with borderlayout setting region north and south to hiddens, but don't work neither.

How can I put these two hiddens to submit it in form.submit method? All combinations that I try don't paint anything or makes window bugged...



Do you mean submitting by calling the submit method of FormPanel? Yes, it submits items only. Content is rendered as raw HTML.

Yes I refer to that case, thanks for the info.

Daniil
Sep 14, 2012, 12:47 PM
Yes I refer to that case, thanks for the info.

Could you then demonstrate, please, where is the FormPanel in your case?

Generally, placing Hiddens into the FormPanel Items should be the best solution.

softmachine2011
Sep 14, 2012, 12:56 PM
Could you then demonstrate, please, where is the FormPanel in your case?

Generally, placing Hiddens into the FormPanel Items should be the best solution.

No, this isn't my problem; only I need a clarification of this behaviour.

But I try to use fitlayout like you see me, and inside the panel there are a treepanel, and two hiddens like in the example.
Only I need to draw a treepanel like the example an position two hiddens anyway.

All of this view is inside the formpanel rendered as a partial view.

Daniil
Sep 14, 2012, 4:50 PM
The problem is the fact that Layouts are not designed to deal with Hiddens. Layouts try to deal with Hiddens as common items, but it fails.

As a workaround, we can suggest to set

Hidden="true"
for the Hiddens.

Then Layouts should ignore them. I just tested, it appears to be working well with both - BorderLayout and FitLayout.

softmachine2011
Sep 18, 2012, 9:03 AM
Works as expected.

Thanks for the trick!