DelphiFAQ Home Search:
General :: Web publishing :: JavaScript :: ExtJS


Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

My extjs store does not load the data

Question:

My extjs data store does not load the data. It is supposed to get the data via http from a JSP page. When I execute it manually, the JSP works.

Answer:

Check with Firefly if all the necessary arguments are passed. You can do it this way:

-1- Set a breakpoint where the store.load() call is.
-2- when you reach the breakpoint, switch to the console tab, and clear it
-3- continue execution (1 step)
-4- check the details of the post request

In your case, you had passed some parameter that was lost when the load() was executed. Below the corrected code.

It is unclear why one would bother to define the params property in the store to begin with.

var
   storeProfiles = new Ext.data.Store({
     // load using HTTP
     url: 'profilexml.jsp',
     params: ({'get_profiles':1}),
 
     // the return will be XML, so lets set up a reader
     reader: new Ext.data.XmlReader({
       record: 'profile',
       'profile_name': 'profile_name',
       totalRecords: '@total'
     },
     [
       // set up the fields mapping into the xml doc
         'profile_name'
     ])
   });
 
   // next line does NOT work:
   storeProfiles.load();
 
   // this does work:
   storeProfiles.load({params:{'get_profiles':1}});
 

Generated 0:02:45 on Nov 20, 2017