Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extraParams are not sent to server [ExtJS 5.0.1] #17

Closed
nicklaros opened this issue Aug 17, 2014 · 1 comment
Closed

extraParams are not sent to server [ExtJS 5.0.1] #17

nicklaros opened this issue Aug 17, 2014 · 1 comment

Comments

@nicklaros
Copy link
Contributor

Hi, is it me or anyone else had this issue.. Why the proxy extraParams are not sent to server?

Note that I'm 100% sure extraParams is there but the request sent to server did not include that extraParams.
for the sake of clarity this is my extraParams after calling mystore.getProxy().extraParams

{nama: "kecap", kode: "l"}

but it only send this request to server

{"event":"stock/read","data":{"sort":[{"property":"name","direction":"ASC"}],"page":1,"limit":200,"start":0}}
@nicklaros
Copy link
Contributor Author

oh sorry for not looking at your code before spitting out some question..
after inspecting how read request on this proxy constructed, looks like there is missing pieces in there. the included parameter is sorter, grouper, and paging params only.

// Remote sorters
if (sorters && sorters.length > 0) {
    data.sort = [];

    for (i = 0; i < sorters.length; i++) {
        data.sort.push({
            property: sorters[i]._property,
            direction: sorters[i]._direction
        });
    }
}

// Remote groupers
if (groupers && groupers.length > 0) {
    data.group = [];

    for (i = 0; i < groupers.length; i++) {
        data.group.push({
            property: groupers[i]._property,
            direction: groupers[i]._direction
        });
    }
}

// Paging params
data.page = operation._page;
data.limit = operation._limit;
data.start = operation._start;

so then I add code below to make sure extraParams is included in read request

// extraParams
var extraParams = operation._proxy.extraParams;
for (var key in extraParams) {
    if (extraParams.hasOwnProperty(key)) {
        data[key] = extraParams[key];
    }
}

and it works like a charm now ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant