PDA

View Full Version : Problem using new <ext-partial> component



plok77
Mar 22, 2021, 5:20 PM
I have the following partial view


@model TMSWeb.ExtNETCore.Pages.Shared.FlagsPartialModel
@{
Html.X().FieldSet()
.Title("Flags")
.Width(400)
.Layout(LayoutType.Container)
.RenderTo("PanelFlags")
.Items(
Html.X().CheckboxGroup()
.Name("Flags")
.Items(Model.Checkboxes)
);
}


that I am trying to host in a panel on a parent page


<ext-panel id="PanelFlags">
<items>
<ext-partial name="_Flags"
model='new FlagsPartialModel { ObjectId = 117, Flags = 17 }' />
</items>
</ext-panel>

The page fails to render with the error


Cannot read property 'dom' of null
at constructor.doInsert (ext-all-debug.js:128095)
at constructor.append (ext-all-debug.js:128068)
at constructor.render (ext-all-debug.js:70846)
at constructor (ext-all-debug.js:74177)
at new Ext.form.FieldSet (ext-all-debug.js:14564)
at eval (eval at getInstantiator (ext-all-debug.js:16491), <anonymous>:3:8)
at Object.create (ext-all-debug.js:17025)
at Customers:18
at Object.invoke (ext-all-debug.js:20532)
at Object.doInvokeAll (ext-all-debug.js:20576)

Looking at the JavaScript code that is generated, the framework is trying to create the FieldSet component in the child partial view before the components in the parent view have been created. So the 'PanelFlags' component that has been specified as the target to render the FieldSet to hasn't been created yet.

Is there something that I'm missing here? What needs to be changed to ensure that the components in the child view are created after those in the parent view?

fabricio.murta
Mar 23, 2021, 3:21 PM
Hello @plok77!

The ext-partial component is not currently the same in capabilities as Ext.NET 5's partial view. Please check out GitHub issue #1819 (https://github.com/extnet/Ext.NET/issues/1819) for more information on the current state of Partial Views support in Ext.NET 7. As pointed in the issue, you can see the current implementation of ext-partial in action if you install the Ext.NET template.

In short, the ext-partial component is paired with the ext-section to compose a view based on its layout page.

Hope this helps!