PDA

View Full Version : directFn is not defined for store



sandeep.r
15 Mar 2011, 2:03 AM
Sir,

Sub : Error in firebug console like this: LoginFacade is not defined
chrome://firebug/content/blank.gif directFn : LoginFacade.getAllCompanies, when I call store.load()


My project was in ExtJs 2.2. It used DWR and Spring 2.0 and Java. Now we are trying to convert our old project to Extjs 3.0 with DirectJngine, Spring and Java. I created a mavan project, make changes in Ext.data.DirectStore,web.xml, all necessary JAR added.

In extjs_remote_methods/Api.js ( In console Script) I got like this.
Ext.namespace("Ext.app");2Ext.app.PROVIDER_BASE_URL=window.location.protocol+"//"+window.location.host+"/"+(window.location.pathname.split("/").length>2?window.location.pathname.split("/")[1]+"/":"")+"djn/directprovider";
3Ext.app.POLLING_URLS={};
4Ext.app.REMOTING_API={url:Ext.app.PROVIDER_BASE_URL,type:"remoting",actions:{LoginFacade:[{name:"getAllCompanies",len:0,formHandler:false}]}};


My code as follows.

web.xml
********
<?xml version="1.0" encoding="UTF-8" ?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>

<!-- DirectJNgine servlet -->

<servlet>
<servlet-name>DjnServlet</servlet-name>
<servlet-class>com.softwarementors.extjs.djn.servlet.DirectJNgineServlet</servlet-class>

<init-param>
<param-name>debug</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>createSourceFiles</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>providersUrl</param-name>
<param-value>djn/directprovider</param-value>
</init-param>
<init-param>
<param-name>batchRequestsMultithreadingEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>apis</param-name>
<param-value>extjs_remote_methods</param-value>
</init-param>
<init-param>
<param-name>extjs_remote_methods.apiFile</param-name>
<param-value>extjs_remote_methods/Api.js</param-value>
</init-param>
<init-param>
<param-name>extjs_remote_methods.apiNamespace</param-name>
<param-value>Ext.app</param-value>
</init-param>
<init-param>
<param-name>extjs_remote_methods.classes</param-name>
<param-value>
com.bs.tg.login.facade.LoginFacade
</param-value>
</init-param>

<load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>DjnServlet</servlet-name>
<url-pattern>/djn/directprovider/*</url-pattern>
</servlet-mapping>

Store
*****
Ext.ux.bs.login.CompanyComboStore = new Ext.data.DirectStore({
paramsAsHash : true,
directFn : LoginFacade.getAllCompanies,
root : '',
idProperty : 'value',

fields : [{
name : 'value'
}, {
name : 'label'
}],
});

Java
****
package com.bs.tg.login.facade;
import com.bs.tg.commons.Company;

public class LoginFacade {

@DirectMethod
public Collection<Company> getAllCompanies() throws NumberFormatException, Exception {

Collection<Company> companyList = new ArrayList<Company>();
Company company = new Company();

company.setName("HP");
company.setId(1);
companyList.add(company);

return company
}
}

When I called Ext.ux.bs.login.CompanyComboStore.load(), I got the error in console like this. LoginFacade is not defined
chrome://firebug/content/blank.gif directFn : LoginFacade.getAllCompanies,

How to resolve this problem . Please help me ?

mitchellsimoens
15 Mar 2011, 8:17 AM
Incorrect forum.

sandeep.r
15 Mar 2011, 11:54 PM
Thanks for replay. Please tell me in which forum I hanv to post

mitchellsimoens
16 Mar 2011, 4:15 AM
Thanks for replay. Please tell me in which forum I hanv to post

In the help forum under the forum that is for the framework you are using.