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

DstoreAdapter does not work with HTTP status 204 (no content) #158

Open
susnux opened this issue Sep 14, 2015 · 0 comments
Open

DstoreAdapter does not work with HTTP status 204 (no content) #158

susnux opened this issue Sep 14, 2015 · 0 comments
Labels

Comments

@susnux
Copy link

susnux commented Sep 14, 2015

I have a lot of dgrids, so I use dstore. But I need a dojo store for dijit/form/FilteringSelect and dijit/Tree.

So I tried DstoreAdapter, but when my server responses with 204, e.g.:
query for parent=42 and there is no item with parent=42 it does nothing.

FilteringSelect and Tree still waits for a response (I see that because there is still the load-animation).

My store-code:

    store = new Rest({
        target: 'api.php/Items'
        useRangeHeaders: true,
        _renderFilterParams: function (filter) {
            var type = filter.type;
            var args = filter.args;
            if (!type)
                return [''];
            if (type === 'string')
                return [args[0]];
            return [encodeURIComponent(args[0]) + '=' + encodeURIComponent(args[1])];
        }
    });
    var search_box = new FilteringSelect({
        store: new DstoreAdapter(store),
        hasDownArrow: false,
        required: false,
        searchAttr: 'name',
        pageSize: 100
    }, 'search_box');

Note: I had to add this modified _renderFilterParams property, because without it it breaks the servers REST API, e.g. it sends:
api.php/Items?name=match=Abc*
instead of
api.php/Items?name=Abc*

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

No branches or pull requests

2 participants