Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

95
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda