PDA

View Full Version : [CLOSED] JavaScript Error when adding Store to a Bin



CarlosG
Mar 04, 2014, 2:46 AM
I've hit an issue with adding a Store to the Bin collection of either a Window, Panel or Portal component. I've only been able to make it work if I add the Store to a Portlet Bin, but that is too low level as I need this store shared by various Portlets.

To reproduce the error, simply create a Window with a Portal in it and Portlets in this portal. When a store is added to the Window or Portal, the following error is produced.

Unhandled exception at line 73294, column 9 in http://localhost:53972/extjs/ext-all-debug-js/ext.axd?v=28616

0x800a138f - JavaScript runtime error: Unable to get property 'items' of undefined or null reference


load: function(options) {
var me = this;

options = options || {};

if (typeof options == 'function') {
options = {
callback: options
};
}

options.groupers = options.groupers || me.groupers.items; <========= ERROR HAPPENS IN THIS LINE
options.page = options.page || me.currentPage;
options.start = (options.start !== undefined) ? options.start : (options.page - 1) * me.pageSize;
options.limit = options.limit || me.pageSize;
options.addRecords = options.addRecords || false;

if (me.buffered) {
options.limit = me.viewSize || me.defaultViewSize;
return me.loadToPrefetch(options);
}
return me.callParent([options]);
},

Daniil
Mar 04, 2014, 5:06 AM
Hi @CarlosG,

I cannot reproduce with this sample. Please provide your one.

Example

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

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

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Panel runat="server" Title="Panel">
<Bin>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="someField" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Bin>
</ext:Panel>
</form>
</body>
</html>

CarlosG
Mar 04, 2014, 5:15 AM
Hi @Daniil,

I'll post the code in a minute, it's made up of a few items distributed in various files.

In the meantime, would you mind trying to change the Panel by a Portal and see if you get the error?

Thanks.

Daniil
Mar 04, 2014, 10:47 AM
It appears to be OK with a Portlet as well. Your turn:)

Example

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

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

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:Portal runat="server">
<Items>
<ext:PortalColumn runat="server">
<Items>
<ext:Portlet runat="server" Title="Portlet">
<Bin>
<ext:Store runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="someField" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Bin>
</ext:Portlet>
</Items>
</ext:PortalColumn>
</Items>
</ext:Portal>
</form>
</body>
</html>

CarlosG
Mar 05, 2014, 12:31 AM
Hi Daniil,

I tried your example in a new project and as expected, it all worked without problem.

There must be something specific to my project that is triggering that condition.

It is very strange because all things being equal and without changing anything, if I instantiate the Store within the Portlet, it all works well, but as soon as I move that instance to the Portal Bin, the error pops up again.

I'll have to do a bit more debugging. I wonder if it has to do with the fact that I'm working with a Desktop as the main Container or that all elements are being built in Code Behind.

Thank you for looking into this anyway. If I ever find out what is causing the issue, I'll let you know.

Daniil
Mar 05, 2014, 4:19 AM
Maybe, this could help to prepare a sample.
http://forums.ext.net/showthread.php?13672&p=56687&viewfull=1#post56687