Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Remove dependence on Backbone.History #5

Closed
fragnemesis opened this Issue · 1 comment

2 participants

@fragnemesis

Unless I'm mistaken, it seems that TableView in its current form is dependent upon the use of Backbone.History. Is this necessary?

For example, on line 113 in JS, in TableView.prototype.initialize():

TableView.prototype.initialize = function() {
//...
this.data = $.extend({}, this.initialData, this.parseQueryString(Backbone.history.fragment));

this code block is called without checking to see if Backbone.history exists.

Yet elsewhere in the code, in TableView.prototype.updateUrl() (line 193 in JS):

TableView.prototype.updateUrl = function(replace) {
//...
if (this.router) {
    uri = Backbone.history.fragment;
}

You check for the existence of this.router before attempting to access Backbone.history.fragment.

Is the use of Backbone.History necessary for TableView, and if not, can this issue be corrected?

I "fixed" this by performing another check in TableView.prototype.initialize for this.router before merging data from this.parseQueryString(Backbone.history.fragment) into this.data. ex:

this.data = $.extend({}, this.initialData);
if (this.router) {
    this.data = $.extend(this.data, this.parseQueryString(Backbone.history.fragment));
}
@jpbottaro jpbottaro closed this issue from a commit
@jpbottaro jpbottaro Remove Backbone.history dependency if router not defined
Thanks to fragnemesis for this change, if router was not defined, we can remove
the use of Backbone.history. Fixes #5
80db9ba
@jpbottaro jpbottaro closed this in 80db9ba
@jpbottaro
Owner

Thanks for this fragnemesis! I did the fix you described in coffeescript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.