PDA

View Full Version : TabPanel destroy raises js error



unicorn64
Apr 25, 2017, 7:14 AM
Hi all,
TabPanel gives js error while destroying


Index.cshtml


@{
var X = Html.X();
}

@(
X.Viewport()
.Items(
X.Toolbar().Docked(Dock.Top)
.Items(
X.Button().Text("Tab").DirectTapAction("Tabs"),
X.Button().Text("Other View").DirectTapAction("Other")
),

X.Container().ID("Main").FitLayout()
.Items(
X.Panel().Html("welcome page")
)
)
)


Tabs.cshtml


@{
var X = Html.X();
}

@(
X.TabPanel()
.Items(
X.Panel()
.Title("Tab 1")
.Items(
X.TextField().Label("text 1.1"),
X.TextField().Label("text 1.2")
),
X.Panel().Flex(1)
.Title("Tab 2")
.Items(
X.TextField().Label("text 2.1"),
X.TextField().Label("text 2.2")
)
)
)


other.cshtml


@(
X.Panel().Title("Other")
.Items(
X.TextField().Label("other")
)
)




public ActionResult Tabs()
{

var pvr = new Ext.Net.Mobile.MVC.PartialViewResult("Main")
{
WrapByScriptTag = true,
ClearContainer = true,
RenderMode = Ext.Net.Mobile.RenderMode.AddTo,
};

return pvr;
}

public ActionResult Other()
{

var pvr = new Ext.Net.Mobile.MVC.PartialViewResult("Main")
{
WrapByScriptTag = true,
ClearContainer = true,
RenderMode = Ext.Net.Mobile.RenderMode.AddTo,
};

return pvr;
}


just change view by clicking buttons


ext-mobile.axd?v=4.1.0:29358 Uncaught TypeError: Cannot read property 'ext-tab-2' of null
at constructor.get (ext-mobile.axd?v=4.1.0:29358)
at constructor.getComponent (ext-mobile.axd?v=4.1.0:52276)
at constructor.remove (ext-mobile.axd?v=4.1.0:51815)
at constructor.onItemRemove (ext-mobile.axd?v=4.1.0:91834)
at constructor.doRemove (ext-mobile.axd?v=4.1.0:51857)
at constructor.removeAll (ext-mobile.axd?v=4.1.0:51879)
at constructor.destroy (ext-mobile.axd?v=4.1.0:52303)
at constructor.doRemove (ext-mobile.axd?v=4.1.0:51860)
at constructor.removeAll (ext-mobile.axd?v=4.1.0:51879)
at Object.Ext.net.addTo (ext-mobile.axd?v=4.1.0:667)

unicorn64
Apr 25, 2017, 10:07 PM
I guess i have found solution,
i dont know why but somehow map property is null on Ext.util.AbstractMixedCollection.get method,
i wrote an override to fix it, it seems work for now



Ext.util.AbstractMixedCollection.override({
get: function (key) {
var me = this,
mk = me.map ? me.map[key] : null, // original was, mk = me.map[key],
item = mk !== undefined ? mk : (typeof key == 'number') ? me.items[key] : undefined;
return typeof item != 'function' || me.allowFunctions ? item : null; // for prototype!
},
});