Spreadsheets / WickedGrid

Easy & Wicked Fast spreadsheets for the web
http://spreadsheets.github.io/WickedGrid
587 stars 131 forks source link

how to open empty spread sheet by default? #106

Open srivasmca opened 7 years ago

srivasmca commented 7 years ago

when i open my project by default an empty spread sheet should be open.

$(function(){
                window.loadSheet = function (obj) {
                     var urls = {menuLeft: 'menu.left.html', menuRight: 'menu.right.html'}, results = {}, loadCount = 2, loaded = 0;
                       for(var type in urls) {
                        var tempUrl = urls[type];
                        $(document.createElement('div'))
                                .data('type', type)
                                .load(tempUrl, function() {
                            results[$(this).data('type')] = this.children[0];
                            loaded++;
                            if (loadCount == loaded) {
                                $('#sheet')
                                    .attr('class', 'jSParent')
                                    .sheet({
                                        /* colMargin:25,
                                        newColumnWidth: 140, */
                                        minSize: {rows: 10, cols: 10},
                                        menuLeft: function() {
                                            var jS = this,
                                            menu = $(results.menuLeft);
                                            //Give anchors access to jS them
                                            menu.find('a').each(function() {
                                                this.jS = jS;
                                            });
                                            return menu;
                                        },
                                        menuRight: function (){
                                            var jS = this,
                                            //we want to be able to edit the html for the menu to make them multi-instance
                                            menu = $(results.menuRight);
                                            //Give anchors access to jS them
                                            menu.find('a').each(function() {
                                                this.jS = jS;
                                            });
                                            menu.find("select").each(function(){
                                                this.jS = jS; 
                                            });
                                            return menu;
                                        }
                                    });
                                }
                            });
                        } 
                    };
                loadSheet({});
            });

i did like above code but the problem is that when inserting rows into spread row index is not coming correctly(sequence is not updated).

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40016578-how-to-open-empty-spread-sheet-by-default?utm_campaign=plugin&utm_content=tracker%2F609152&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F609152&utm_medium=issues&utm_source=github).