[CLOSED] Upgrade from version 3 to version 4 page get error: Uncaught TypeError: Cannot read property 'data' of undefined
Upgrade from ext net version 3 to version 4. I have a page when page first load it will get vaule from cookie to select the value in comobox. javascript function showSearchResult will get cookie value and select this value in comobox. in store load event will call this function. This works in previous version. but not work when upgrade to version 4. page get error in Chrome development tool console: Uncaught TypeError: Cannot read property 'data' of undefined
Code:
<ext:Store ID="storeDocTypes" runat="server" AutoLoad="true">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="DocTypeID">
<Fields>
<ext:ModelField Name="DocTypeID" />
<ext:ModelField Name="Name" />
</Fields>
</ext:Model>
</Model>
<Listeners>
<Load Handler="SetDocumentActiveXIsInstall();showSearchResult(#{storeDocTypes},#{cmbDocTypes},#{Tab1});" />
</Listeners>
</ext:Store>
Code:
function showSearchResult(storeDocTypes,cmbDocTypes,tab1)
{
if (storeDocTypes.data.items.length>0 )
{
var doctype = getCookie("DocType");
if (doctype.length>0)
{
cmbDocTypes.setValue(parseInt(doctype));
ShowSearchForm(tab1,doctype);
}
else
{
cmbDocTypes.setValue(storeDocTypes.data.items[0].data.DocTypeID);
ShowSearchForm(tab1,storeDocTypes.data.items[0].data.DocTypeID);
}
}
else
{
var Button1 = <%= Button1.ClientID %>;
var Button2 = <%= Button2.ClientID %>;
Button1.hide();
Button2.hide();
}
}