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

Stores created with StoreAdapter are not Trackable? #125

Open
kfranqueiro opened this issue May 27, 2015 · 0 comments
Open

Stores created with StoreAdapter are not Trackable? #125

kfranqueiro opened this issue May 27, 2015 · 0 comments

Comments

@kfranqueiro
Copy link
Member

While the docs state that legacy stores created with DstoreAdapter will be observable if the originating dstore instance is trackable (and I've seen that in action), the reverse does not appear to be the case. In fact, there seems to be no reference to observe anywhere in StoreAdapter.

Given that the observation models between dojo/store and dstore are quite different (to the point where dojo/store's observe is tucked away on query results whereas track is exposed at the top level), is this something that wasn't considered realistic to implement? It seems like it'd be quite an impediment to the adapter being useful for migration purposes.

Example page (in which tracking doesn't work):

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" href="../css/skins/claro.css">
    </head>
    <body class="claro">
        <button id="update">Update first item</button>
        <div id="grid"></div>
        <script src="../../dojo/dojo.js" data-dojo-config="async: true"></script>
        <script>
            require([
                'dojo/_base/declare',
                'dojo/on',
                'dgrid/OnDemandGrid',
                'dojo/store/Memory',
                'dojo/store/Observable',
                'dstore/Trackable',
                'dstore/legacy/StoreAdapter'
            ], function (declare, on, OnDemandGrid, Memory, Observable, Trackable, StoreAdapter) {
                var legacyStore = new Observable(new Memory({ data: [
                    { id: 1, name: 'foo' },
                    { id: 2, name: 'bar' }
                ] }));
                var store = new StoreAdapter({ objectStore: legacyStore });
                store = Trackable.create(store);

                var grid = new OnDemandGrid({
                    columns: {
                        id: 'ID',
                        name: 'Name'
                    },
                    collection: store
                }, 'grid');

                on(document.getElementById('update'), 'click', function () {
                    store.put({ id: 1, name: 'foo' });
                });
            });
        </script>
    </body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants