Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    55
    Vote Rating
    0
    necco is on a distinguished road

      0  

    Question OData proxy

    OData proxy


    I'm using Oleg Dolzhansky's code:
    Code:
    /*
    
    
    Open Data Protocol Implementation for Ext Js 4
    Links:
    ExtJs 4 Server Proxy: http://docs.sencha.com/ext-js/4-0/source/Server.html#Ext-data-proxy-Server
    ExtJs 4 Ajax Proxy: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.proxy.Ajax
    OData URI Conventions: http://www.odata.org/developers/protocols/uri-conventions
    License: GNU General Public License v3 http://www.gnu.org/copyleft/gpl.html
    Author: Oleg Dolzhansky dolzhansky@gmail.com
    
    
    */
    
    
    Ext.define('ReaderOData',{
        extend: 'Ext.data.reader.Json',
        alternateClassName: 'ReaderOData',
        alias: 'reader.odata',
        root: 'd'
        ,totalProperty: 'd.__count',
        buildExtractors : function() {
            var me = this;
            me.callParent(arguments);
            me.getRoot = function(root) {
                if (root.d) {
                    if (root.d.results) {return root.d.results; }
                    else { return root.d; }
                }
                else { return root; }
            };
         }
    });
    
    
    Ext.define('ProxyOData', {
        extend: 'Ext.data.proxy.Ajax',
        requires: ['ReaderOData'],
        alternateClassName: 'ProxyOData',
        alias: 'proxy.odata',
        /* Builds URL in the form Entity(Id), for example http://localhost/Service.svc/Customers(5) */
        buildUrl: function (request) {
            var me = this,
                operation = request.initialConfig.operation,
                records = operation.records || [],
                record = records[0],
                url = me.getUrl(request),
                id = record ? record.getId() : operation.id;
                 
            if (id) {
                if (url.match(/\/$/)) {
                    url = url.substring(0, url.length - 1);
                }
                url = url + '(' + id + ')';
            }
            if (request.action == 'read') {
                request.params = Ext.apply(request.params, {'$inlinecount': 'allpages'});
            }
    
    
            request.url = url;
            
            return me.callParent(arguments);
        },
    
    
        /* Returns a string of comma-separated fields from sortes with optional 'desc' directive */
        encodeSorters: function (sorters) {
            var min = [],
                length = sorters.length,
                i = 0;
    
    
            for (; i < length; i++) {
                min[i] = sorters[i].property;
                if (sorters[i].direction.toLowerCase() == 'desc') {
                    min[i] += ' desc';
                }
            }
    
    
            return min.join(',');
        }
    
    
    }, function () {
        Ext.apply(this.prototype, {
            actionMethods: {
                create: 'POST',
                read: 'GET',
                update: 'PUT',
                destroy: 'DELETE'
            },
            reader: {
                type: 'odata'
            },
            headers: {
                'Accept': 'application/json'            
            },
            pageParam: undefined,
            startParam: '$skip',
            limitParam: '$top',
            sortParam: '$orderby',
            noCache: false
        });
    });
    index.html:
    Code:
    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>DataLight Rapoarte Web</title>
        <link href="img/icon_16.png" rel="shortcut icon" type="image/x-icon" />
        
        <link rel="stylesheet" href="css/sencha-touch.css" type="text/css">
    
    
    
    
        <script type="text/javascript" src="sencha/builds/sencha-touch-all-debug.js"></script>
        
        <script type="text/javascript" src="proxyOData.js"></script>
        <script type="text/javascript" src="lista.js"></script>
        <script type="text/javascript" src="app.js"></script>
           
    </head>
    <body>
    </body>
    </html>
    app.js:
    Code:
    Ext.Loader.setConfig({
        disableCaching: false
    });
    
    
    Ext.application({
        name: 'Test'
        ,tabletStartupScreen: 'resources/img/tablet_startup_atto.png'
        ,phoneStartupScreen: 'resources/img/phone_startup_atto.png'
        ,icon: 'resources/img/icon_atto.png'
        ,glossOnIcon: false
        ,launch: function(){
                    var customersStore = Ext.create('CustomersStore');
                    customersStore.load();
                    var customersList = Ext.create('CustomersList', {
                                                store: customersStore
                                                }
                    );
                    Ext.Viewport.add(customersList);
                    console.log(customersStore.getCount());
                }
    });
    lista.js
    Code:
    Ext.define('Customer', {
                extend: 'Ext.data.Model',
                requires: ['ProxyOData'],
                config: {
                        fields: [
                            //{name: '__metadata.uri'},
                            //{name: 'CODAGENT', type: 'auto'},
                            //{name: 'NUMEAGENT', type: 'string'}
                            {name: 'City', type: 'string'}
                            //{name: 'CustomerID', mapping: 'CustomerID', type: 'auto'}
                        ]
                        //,idProperty: 'CODAGENT'
                        //,idProperty: '_metadata.uri'
                        //,idProperty: 'id'
                        //,idProperty: 'CustomerID'
                        ,proxy: {
                                type: 'odata'
                                //,url: 'http://192.168.1.223/ro2/odata/DataLightERP/CRM/AGENTI?$format=json'
                                ,url: 'http://192.168.1.223/ro3/Northwind/Northwind.svc/Customers?$format=json'
                                }
                        }
            });
    
    
        Ext.define('CustomersStore',{
                extend: 'Ext.data.Store', 
                config: {
                        model: 'Customer'
                        }
            });
            
        Ext.define('CustomersList',{
                    extend: 'Ext.List',
                    requires: ['Ext.TitleBar'],
                    config: {
                            fullscreen: true,
                            itemTpl: '{City}',
                            //itemTpl: '<div class="contact"><strong>{City}</strong></div>',
                            //store: CustomersStore,
                            emptyText: '<div style="margin-top: 20px; text-align: center">No Matching Items</div>',
                            items: [
                                    {xtype: 'titlebar',
                                    docked: 'top',
                                    title: 'CRM - Agenti'
                                    }
                                    ]
                    }
                });
    (Redirects and aliases are properly set in Apache config file)

    The problem is that the store is not loaded.

    I can't figure out why? Where is the mistake?

  2. #2
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    543
    Vote Rating
    18
    estesbubba will become famous soon enough

      0  

    Default


    Add autoLoad: true to your store?

  3. #3
    Sencha User
    Join Date
    Mar 2010
    Posts
    55
    Vote Rating
    0
    necco is on a distinguished road

      0  

    Default


    I did... no changes... the store is not loading.

Thread Participants: 1