Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
Ext.Direct functions available within javascript

I have implemented Ext.Direct to return data to a Store however the directFn methods are not available within the javascript.

api.php returns var Ext = Ext || {}; Ext.REMOTING_API = {"url":"php/api/router.php","type":"remoting","actions":{"RaStatuses":[{"name":"get_ra_statuses","len":1}]}};

router.php returns {"type":"rpc","tid":1,"action":"RaStatuses","method":"get_ra_statuses","result":[{"ra_no":"2"},{"ra_no":"4"},{"ra_no":"6"},{"ra_no":"8"},{"ra_no":"10"}]}

...and successfully populates this store

Ext.define('CSM.store.ra.Statuses', {
  extend: 'Ext.data.Store',
  model: 'CSM.model.ra.Status',
  proxy: {
    type: 'direct',
    directFn: "RaStatuses.get_ra_statuses"
  },
  autoLoad: true
});

However when I use this line from within a javascript function a = RaStatuses.get_ra_statuses();

...I get 'ReferenceError: RaStatuses is not defined'

Have I misunderstood? Should Ext.Direct make this object available inside the js or was this wishful thinking?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This now works (ExtJS 6.0.2). I amended api.php to return...

Ext.namespace('RPC');   
var Ext = Ext || {};
RPC.REMOTING_API = {
    "url": "php/api/router.php",
    "type": "remoting",
    "namespace": "RPC",
    "descriptor": "RPC.REMOTING_API",
    "actions": {
        "RaStatuses": [{
            "name": "get_ra_statuses",
            "len": 0
        }]
    }
};
Ext.direct.Manager.addProvider(RPC.REMOTING_API);

This call now returns data

RPC.RaStatuses.get_ra_statuses();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!