How to use Odata proxy

  1. #1

    How to use Odata proxy

    Hello, I found Odata proxy project
    http://www.sencha.com/forum/showthre...-for-ExtJS-4.1

    But I don't know how to use it.

    Should I create my own proxy, or there is simpler way?

    Thank you
  2. #2
    You have to implement it as server side class and use in the store
    You can investigate Ext.Net Proxy classes to understand how to implement own Proxy
  3. #3

    Thanks

    Thank you, I solve it using following code. It works fantastic with webapi :-)

    public class OdataProxy : Ext.Net.AjaxProxy
    {
            [Ext.Net.ConfigOption]
            [System.ComponentModel.DefaultValue("odata")]
            protected override string Type { get {return "odata"; } }        
    }
  4. #4

    Support for GridFilters

    I add suport for GridFilters, if anyone is interested.

    Markup
                         <ext:GridFilters runat="server" ParamPrefix="$filter">
                            <Filters>
                                <ext:NumericFilter DataIndex="Id" />
                                <ext:StringFilter DataIndex="Name"  />
                                <ext:StringFilter DataIndex="Category"  />
                                <ext:NumericFilter DataIndex="Price" />                            
                            </Filters>
                            <CustomConfig>
                                <ext:ConfigItem Name="buildQuery" Mode="Raw" Value="buildQueryOdata" />
                            </CustomConfig>
                        </ext:GridFilters>
    And Javascript function:
     //http://docs.sencha.com/ext-js/4-1/source/FiltersFeature.html#Ext-ux-grid-FiltersFeature-method-buildQuery
    //http://www.odata.org/documentation/uri-conventions
            function buildQueryOdata(filters) {
                var p = {}, i, f, dataPrefix,
                    len = filters.length,
                    odata = "",
                    value;
    
                for (i = 0; i < len; i++) {
                    f = filters[i];
    
                    if (odata != "") odata += " and ";
                    value = f.data.type == "string" ? "'" + f.data.value + "'" : f.data.value;
    
                    if (f.data.comparison != null) {
                        odata += f.field + " " + f.data.comparison + " " + value;
                    } else {
                        //substringof('Alfreds', CompanyName) eq true
                        odata += "substringof(" + value + "," + f.field + ") eq true";
                    }                
                }
    
                var p = {};
                if (odata != "") p[this.paramPrefix] = odata;
                return p;            
            }
  5. #5
    Good news...

    We're going to add full OData Proxy support to Ext.NET 2.2. With some luck this functionality should be committed to SVN this week.
    Geoffrey McGill
    Founder
  6. #6
    Vladimir committed ODataProxy to SVN.

Similar Threads

  1. ext.net 2.0 web browser proxy question
    By snakeeyes in forum 2.x Help
    Replies: 0
    Last Post: Oct 12, 2012, 3:29 AM
  2. Wcf, Odata, REST and Ext.net. Error
    By luiz in forum 1.x Help
    Replies: 1
    Last Post: Jun 15, 2012, 3:09 AM
  3. What exactly is Page Proxy?
    By chearner in forum 1.x Help
    Replies: 5
    Last Post: Jan 09, 2012, 9:52 PM
  4. Multicombo store proxy
    By David Pelaez in forum 1.x Help
    Replies: 1
    Last Post: Feb 08, 2011, 1:27 PM
  5. Proxy with Nested Url
    By Dominik in forum 1.x Help
    Replies: 3
    Last Post: Jun 10, 2010, 6:53 AM

Tags for this Thread

Posting Permissions