[FIXED] [#796] [3.2.0] ODataProxy broken?

Page 1 of 2 12 LastLast
  1. #1

    [FIXED] [#796] [3.2.0] ODataProxy broken?

    Hi,

    I am trying to use the ODataProxy and the buildUrl method breaks at the line:
    operation = request.operation, 
    records = operation.getRecords()
    request.operation is undefined but request._operation is defined.

    I tried overriding the .BuildUrl config option of ODataProxy and call a copy of the function with request.operation replaced by request._operation but that bombs on the final line return me.callParent(arguments); (undefined o).

    Any ideas on what I might be doing wrong?

    Thanks
    Last edited by Daniil; Jun 23, 2015 at 12:07 PM. Reason: [FIXED] [#796] [3.2.0]
  2. #2
    Hi @t316,

    Please try this override:
    Ext.data.proxy.OData.override({
        buildUrl: function (request) {
            var me = this,
                //operation = request.operation,
                operation = request.getOperation(),
                records = operation.getRecords() || [],
                record = records[0],
                format = me.format,
                url = me.getUrl(request),
                params     = request.getParams() || {},            
                id = record && !record.phantom ? record.getId() : operation.id;
    
            if (me.appendId && id) {
                if (url.match(/\/$/)) {
                    url = url.substring(0, url.length - 1);
                }
                url = url + "(" + id + ")";
            }
    
            if (request.getAction() == "read") {
                request.setParams(Ext.apply(params, { "$inlinecount": "allpages" }));
            }
    
            if (format) {
                if (!url.match(/\.$/)) {
                    url += ".";
                }
    
                url += format;
            }
    
            request.setUrl(url);
    
            delete params[me.getIdParam()];
    
            return me.callSuper(arguments);
            //return me.callParent(arguments);
        }
    });
  3. #3
    Thank you - this fixed that issue, however when I update the record now there is a problem in:
    doRequest: function(operation) {
            var scope = operation.getInternalScope();
            this.setSortParam(scope.getRemoteSort() ? "$orderby" : null);
            this.setFilterParam(scope.getRemoteFilter() ? "$filter" : null);
            this.setStartParam(this.enablePagingParams ? "$skip" : null);
            this.setLimitParam(this.enablePagingParams ? "$top" : null);
            this.getWriter().setAllowSingle(true);
            this.json = true;
            return this.callParent(arguments);
        }
    It seems the getRemoteSort and getRemoteFilter methods are undefined.

    How can I fix that? Thanks
  4. #4
    Thank you - this fixed that issue
    Thank you for the confirmation. I did the change locally in Ext.NET sources and will commit it to SVN soon. It will go to Ext.NET v3.1.0 release.

    It seems the getRemoteSort and getRemoteFilter methods are undefined.
    Could you, please, provide a test case to reproduce?
  5. #5
    Hi @Daniil,
    I'm getting the same error. Below I upload a sample to reproduce it.

    https://drive.google.com/file/d/0BxZ...ew?usp=sharing

    Hope you could help us please.

    P.S.: I swap to ODataV3 because It looks like EXT.NET doesnt support ODataV4.
  6. #6
    Hello @Daniil, any help with this issue? I would appreciate if you could provide an example using GridPanel (or other widgets) with ODataProxy, ODataReader.

    Best regards.
  7. #7
    Thank you for the test project!

    Please try with ODataV3 and this override. I was able to get the test project working with this override.
    Ext.data.reader.OData.override({
        read: function (response, readOptions) {
            if (response && response.responseText == "") {
                return this.nullResultSet;
            }
    
            var data;
    
            if (response) {
                data = response.responseText ? this.getResponseData(response) : this.readRecords(response, readOptions);
            }
    
            return this.callSuper([ data || this.nullResultSet, readOptions ]);
        }
    });
  8. #8
    Dear Daniil,
    Thanks for your answer, I used your code, this is the answer for my other post (this) and it works perfectly for reading with ODataReader, but unfortunatly this issue is still happening when trying to update the record.

    Open the example uploaded here and try to update one record, you will see the next error is throw:

    Uncaught TypeError: scope.getRemoteSort is not a function
    Ext.define.doRequest @ ext.axd?v=29030:929
    Ext.cmd.derive.update @ ext.axd?v=29030:19
    Ext.cmd.derive.doExecute @ ext.axd?v=29030:19
    Ext.cmd.derive.execute @ ext.axd?v=29030:19
    Ext.cmd.derive.runOperation @ ext.axd?v=29030:19
    Ext.cmd.derive.start @ ext.axd?v=29030:19
    Ext.cmd.derive.batch @ ext.axd?v=29030:19
    Ext.data.ProxyStore.override.sync @ ext.axd?v=29030:1007
    Ext.create.buttons.handler @ ext.axd?998f9090c9e54d1e92cb691b33571f9e:2
    Ext.apply.callback @ ext.axd?v=29030:19
    Ext.cmd.derive.fireHandler @ ext.axd?v=29030:19
    Ext.cmd.derive.onClick @ ext.axd?v=29030:19
    fire @ ext.axd?v=29030:19
    Ext.cmd.derive.fire @ ext.axd?v=29030:19
    Ext.cmd.derive.publish @ ext.axd?v=29030:19
    Ext.cmd.derive.doDelegatedEvent @ ext.axd?v=29030:19
    Ext.cmd.derive.onDelegatedEvent @ ext.axd?v=29030:19
    Ext.Function.j.bind.s @ ext.axd?v=29030:19
    Thanks in advance for your attention, and sorry for my post in both thread :)
    Regards!
  9. #9
    I will try to investigate this issue tomorrow or a bit later.
  10. #10
    Thank you Daniil, I will be here waiting :D

    Have a nice day!
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] PartialViewResult broken for v2.2.0
    By gets_gui in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Mar 18, 2013, 8:56 PM
  2. asp.net MVC example broken
    By Z in forum 2.x Help
    Replies: 0
    Last Post: Aug 24, 2012, 1:31 PM
  3. [CLOSED] MVC Example Broken?
    By paulc in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jul 07, 2011, 8:33 AM
  4. Store beforerecordinserted is broken
    By plykkegaard in forum 1.x Help
    Replies: 2
    Last Post: Nov 25, 2009, 9:25 AM
  5. [CLOSED] RadioButton broken
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 17, 2009, 11:00 AM

Posting Permissions