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

Empty store at grid creation breaks on single added item update when noDataMessage is provided. #693

Closed
justindoherty opened this issue Aug 6, 2013 · 1 comment

Comments

@justindoherty
Copy link
Contributor

If I create an OnDemandGrid with no items in the store that has a noDataMessage provided and add a new item and then update that item, the grid throws an error and the grid display is empty.

This doesn't seem to happen if the grid was created with an item in it and it also does not happen if no noDataMessage was provided.

If you apply the following changes to test/editor.html and click create grid you can see the error I am talking about.

diff --git a/test/editor.html b/test/editor.html
index 07e3a6c..edd0075 100644
--- a/test/editor.html
+++ b/test/editor.html
@@ -229,11 +229,7 @@
                            store,
                            i;

-                       for (i = 0; i < 200; i++){
-                           data.push(lang.mixin(options.generate(i), { id: i }));
-                       }
-                       
-                       store = new TestStore({ data: data });
+                       store = Observable(new TestStore({ data: data }));
                        if(async){
                            store = new DeferredWrapper(store, 100);
                        }
@@ -260,11 +256,18 @@
                            if(!grid){
                                grid = new CustomGrid({
                                    store: store,
+                                   noDataMessage: "No Data Message",
                                    columns: {
                                        "editor": editor(lang.mixin({}, options.column, columnArgs))
                                    },
                                    farOffRemoval: async ? 400 : Infinity
                                }, "grid");
+                               
+                               setTimeout(function() {
+                                   var item = {id:0, editor:"Initial Value"};
+                                   store.add(item);
+                                   store.put(item);
+                               });
                            }else{
                                // instead of destroying/recreating, just reset store + columns
                                grid.set("store", null);
@kfranqueiro
Copy link
Member

Thanks for the report. I can also reproduce this easily in test/OnDemand.html by clicking Set empty store under the first grid, then entering grid.put({ id: 1, col1: "foo" }); twice in the console.

This is a regression as of 0.3.9, so I'm taking an initial look at it today.

@ghost ghost closed this as completed in 56d9de6 Aug 8, 2013
This issue was closed.
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

2 participants