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

Page 2 of 2 FirstFirst 12
  1. #11
    Maybe this could help

    In

    Ext.data.proxy.OData
    When updating, scope.getRemoteSort and scope.getRemoteFilter are undefined

                doRequest: function (operation) {
                    debugger;
                    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);
                }
  2. #12
    Please try this override:
    Ext.data.proxy.OData.override({
        doRequest: function (operation) {
            var scope = operation.getInternalScope();
    
            if (!scope.getRemoteSort) {
                scope = operation.getRecords()[0].store;
            }
    
            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.callSuper(arguments);
        }
    });
    It helps getting rid of the error, but I am not sure it makes the entire OData scenario working. So, please let me know if you encounter issues further.
  3. #13
    Thank you so much @Daniil, it works fine in my example project. Now I will use it in my production project.

    Can I ask future issues about this topic in this thread or it is better to create a new one?

    Best regards.
  4. #14
    Thank you for the confirmation.

    Now I will use it in my production project.
    Please let me know after some testing it works well or not and I will incorporate the overrides into SVN.

    Can I ask future issues about this topic in this thread or it is better to create a new one?
    If you find a new issue within a week (or so), please feel free to post here. If more than a week (or so), then let's consider the topic closed because OData is not broken anymore. After that you are welcome to start new threads. You can cross-reference a new thread with the current one if related.
  5. #15
    Thanks @Daniil for your answer.
    Following with tests, now when I want to delete an item I got same error


    Uncaught TypeError: Cannot read property 'getRemoteSort' of null
    Ext.data.proxy.OData.override.doRequest @ Index:42
    Ext.cmd.derive.erase @ 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?e91d240d226b49699e8c8464ce1aca68: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:19fire @ 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
    In same function,

                doRequest: function (operation) {
                    var scope = operation.getInternalScope();
    
                    if (!scope.getRemoteSort) {
                        scope = operation.getRecords()[0].store; // <------- This returns null, so scope is null :(
                    }
    
                    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.callSuper(arguments);
                }
    Uploaded test example.

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

    Sorry for bring troubles :(
  6. #16
    No, WE apologize from the broken OData functionality and thank you for the patience and reporting the problem to us.

    Please try this override of doRequest instead of the previous one.
    Ext.data.proxy.OData.override({
        doRequest: function (operation) {
            var scope = operation.getInternalScope();
    
            if (operation.getAction() === "read") {
                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.callSuper(arguments);
        }
    });
  7. #17
    Thank you very much Daniil, it works like a charm.
    I was thinking in that option (validate if operation was reading) but I dont really know the js code generated.
    Thanks again for all the help.

    Best regards.
  8. #18
    Hello Daniil, this is Piyey back again.

    After doing a bit of test in GridPanel with OData Proxy (GET, POST, PUT) all works perfect, except with the following scenario.

    I add a new record (fine)
    I try to update that record (fail)

    Trying to investigate the error, I saw that when I POST the new record, the response adds a property (odata.metadata in my project, @odata.context in the sample project uploaded before).

    Unfortunately, in the test project works perfectly, couldn't reproduce the error, but in my developed project throws the error. The only difference is in my test project the property starts with @, but in my real project it doesn't.

    POST Request, send appropriate properties to the controller (works).
    Click image for larger version. 

Name:	Post Request.PNG 
Views:	44 
Size:	27.4 KB 
ID:	23965

    POST Response, brings all entity properties plus odata.metadata property (works).
    Click image for larger version. 

Name:	Post Response.PNG 
Views:	37 
Size:	20.8 KB 
ID:	23966

    PUT Request, try to send all entity properties plus odata.metadata property added in POST Response (fails).
    Click image for larger version. 

Name:	Put Request.PNG 
Views:	34 
Size:	32.3 KB 
ID:	23967

    PUT Response, ERROR, odata property doesn't exist in the type. Be sure you only use property names defined in the type.
    Click image for larger version. 

Name:	Put Response.PNG 
Views:	37 
Size:	23.0 KB 
ID:	23968

    As I mentioned before, in the test project uploaded it Works fine. I will appreciate if you can help me with this new issue.

    Thanks for your attention.
  9. #19
    So, how can we change a PUT request to get it working? What is actually wrong with a PUT request?

    I am also don't quite understand why it is not reproducible with the test project... Could you change something in the test project to get it reproducible there as well?
  10. #20
    Hello @Piyey,

    I've applied the overrides to SVN trunk in the revision 6431. It will go to the upcoming Ext.NET 3.2.0 release.

    I hope you've got it working finally. If we need to fix something else in our sources, please let us know.
Page 2 of 2 FirstFirst 12

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