Results 1 to 3 of 3

Thread: Laravel 4 direct service provider

  1. #1

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409

    Default

    Thank you for the information. I am sure it will be useful.

  3. #3
    Sencha User
    Join Date
    Sep 2014
    Posts
    0

    Default Uncaught TypeError: Cannot read property 'directCfg' of undefined

    Hello predator

    Thank you for adapting laravel to ext.direct
    I'm new to extJS and I need to create an API with laravel.

    To try it out, I chose the direct_grid_pt1 velociraptor example
    http://docs.sencha.com/extjs/4.1.3/#...irect_grid_pt1

    Following Error is shown
    Uncaught TypeError: Cannot read property 'directCfg' of undefined

    This is the code of the app
    Code:
    Ext.require([
        'Ext.direct.*',
        'Ext.data.*',
        'Ext.grid.*'
    ]);
    Ext.define('PersonalInfo', {
        extend: 'Ext.data.Model',
        fields: ['id', 'name', 'address', 'state']
    });
    Ext.onReady(function () {
        //add a provider to our grid
        Ext.direct.Manager.addProvider(Ext.rpc.REMOTING_API);
    
        // create the Grid
        Ext.create('Ext.grid.Panel', {
            store: {
                model: 'PersonalInfo',
                autoLoad: true,
                proxy: {
                    type: 'direct',
                    directFn: Ext.rpc.Velocis.getResults
                }
            },
            columns: [{
                    dataIndex: 'id',
                    width: 50,
                    text: 'ID'
                }, {
                    dataIndex: 'name',
                    flex: 1,
                    text: 'Name'
                }, {
                    dataIndex: 'address',
                    flex: 1.3,
                    text: 'Address'
                }, {
                    dataIndex: 'state',
                    flex: 1,
                    text: 'State'
                }],
            height: 450,
            width: 700,
            title: 'Velociraptor Owners',
            renderTo: Ext.getBody()
        });
    });
    This is the JavaScript that is generated by the Laravel 4 direct service provider:
    Code:
    if (Ext.syncRequire)
        Ext.syncRequire('Ext.direct.Manager');
    Ext.namespace('Ext.rpc');
    Ext.rpc.REMOTING_API = {
        "url": "http:\/\/extdirect-cors.local\/rpc?javascript",
        "type": "remoting",
        "timeout": 30,
        "namespace": "Ext.rpc",
        "descriptor": "Ext.rpc.REMOTING_API",
        "actions": {
            "Velocis": [{"name": "index", "len": 0}]
        }
    };
    Ext.Direct.addProvider(Ext.rpc.REMOTING_API);
    What am I missing? Any hints could help.

    Thank you very much!

  4. #4
    Sencha Premium Member
    Join Date
    Mar 2010
    Posts
    150

    Default

    Sorry for the late response, I guess you already solve it or abandon it. Anyway: I cannot really say what is causing the problem, but it seems like you might be calling this -> //add a provider to our grid Ext.direct.Manager.addProvider(Ext.rpc.REMOTING_API);too early. In matter of facts you dont have to call this at all, the remoting provider is global and not per component. It will be added by the generated code. Make sure you follow the instructions on github closely and you should be good to go. I wrote this laravel wrap for a project that is already in production then pulled it out and publish on github, if you follow the steps in the readme precisely you should end up with working setup.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •