Example Documentation

55 views
Skip to first unread message

Par1cle

unread,
Jun 29, 2012, 5:04:56 AM6/29/12
to open...@googlegroups.com
Hi,

I'm looking to use Coweb in a project and just wanted to let you know the issues I've encountered so far (and solutions too).

I'm attempting to get the shopping list example working and the first thing I noticed was that the website documentation is way out of date. So I setup Sphinx on an Ubuntu VM to rebuild the docs and use those instead. Doing this means that I now get code that uses the dojo AMD mechanism.

Then I couldn't get the dojo parser code to work and scratched my head for an hour or so. Stripping it back I can up with the following changes from the given sample code that works fine for me.

define([
    'dojo/parser', 
    'dojo/data/ItemFileWriteStore',
    'coweb/main', 
    'dojo/domReady!',
    'dijit/layout/BorderContainer',
    'dijit/layout/ContentPane',
    'dijit/form/Button',
    'dojox/grid/DataGrid'
], function(parser, ItemFileWriteStore) {
    var app = {
        init: function() {
            console.log("In init...");
            parser.parse();

            var emptyData = { identifier: 'id', label: 'name', items: [] };
            this.dataStore = new ItemFileWriteStore({ data: emptyData });
            this.grid = dijit.byId('grid');
            this.grid.setStore(this.dataStore);

            var addButton = dijit.byId('addRowButton');
            var removeButton = dijit.byId('removeRowButton');
            dojo.connect(addButton, 'onClick', this, 'onAddRow');
            dojo.connect(removeButton, 'onClick', this, 'onRemoveRow');
        },

        onAddRow: function() {
            var date = new Date();
            var id = String(Math.random()).substr(2) + String(date.getTime());
            this.dataStore.newItem({
                id: id,
                name: 'New Item',
                amount: 0
            });
        },

        onRemoveRow: function() {
            this.grid.removeSelectedRows();
        }
    };

    app.init();
});

One of the problems is that the cowebx package doesn't exist and so BusyDialog cannot be found. Looking through the POM file it isn't in there as a war overlay and looking on Maven Central there is only a really old version available. I'm going to try and forge ahead ignoring this class for now but is there any way I can get it from another package? The specific pom instructions would be great if they are available.

Thanks everyone

Chris Cotter

unread,
Jul 1, 2012, 6:47:52 PM7/1/12
to open...@googlegroups.com
Hi,

The most critical issue is that the tutorial was out of date, and the instructions often lead to code that did not work correctly.

The most up-to-date master commits on the coweb github (contains an updated tutorial) and cowebx github (contains updated colist code). You can also view a compiled version of the updated tutorial.

To respond to some of the specific issues you came across:
 * The parser code not working was just incorrect code on the tutorial.
 * The BusyDialog could not be found because the POM file should have a dependency and overlay option for the `cowebx-widgets-dojo` package. See the new section in the tutorial.

If you're interested, there is an associated github issue: https://github.com/opencoweb/coweb/issues/192. In general, the documentation is out of date, and we also have a ticket for updating documentation in general: https://github.com/opencoweb/coweb/issues/181

Please let us know if you are still having trouble with the shopping list tutorial. The updated tutorial *should* lead to a working application, but it hasn't been tested by anyone besides me.

Chris
Reply all
Reply to author
Forward
0 new messages