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

backbonedemo question #17

Open
milescui opened this issue Jan 10, 2012 · 1 comment
Open

backbonedemo question #17

milescui opened this issue Jan 10, 2012 · 1 comment

Comments

@milescui
Copy link

exports.Class = BackboneView.extend({
    type: 'tableview',
    editable: true, 

    events: {
        click: function(e){
            var model = todos.getByCid(e.rowData._modelCid);
            model.set({ hasCheck: !model.get('hasCheck') });
        },
        "delete": function(e){
            var model = todos.getByCid(e.rowData._modelCid);
            todos.remove(model);
        }
    }
});

How to not through the global variables obtained todos reference?

thanks
/Miles

@milescui
Copy link
Author

exports.Class = BackboneView.extend({
    type: 'tableview',
    editable: true, 
    events: {
        click: 'open',
        "delete": function(e){
            var model = todos.getByCid(e.rowData._modelCid);
            todos.remove(model);
        }
    },

    open: function(e) {
        var model = this.getCollection().getByCid(e.rowData._modelCid);
        model.set({ hasCheck: !model.get('hasCheck') });
    },
});

this.getCollection() throw exception run on iphone, but it success run on android.

iphone Exception info:

[WARN] Exception in event callback. {

expressionBeginOffset = 665;

expressionCaretOffset = 685;

expressionEndOffset = 694;

line = 28;

message = "Result of expression 'this.getCollection()' [null] is not an object.";

name = TypeError;

sourceId = 300567264;

}

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

1 participant