Giter VIP home page Giter VIP logo

backbone.tableview's People

Contributors

jgrande avatar jpbottaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backbone.tableview's Issues

No package.json

We'd love to be able to install and use via NPM, but you've not published it!

Multiple fast requests leave the table in inconsistent state

Since the ordering of the incoming responses of parallel requests is unknown, and the table is updated when the 'reset' event is fired in the collection, it can reach inconsistent states.

We should only care about the last request (as per user input), and cancel/ignore the rest.

Allow for zero-based page index

It would be great if there was a way to configure/allow for pagination page indexes to be zero-based.

There are probably more elegant solutions, but my current workaround is to overwrite TableView.prototype.update like so:

TableView.prototype.update = function(replace, skipFetch) {
    this.$("tbody").removeClass("in");
    this.trigger("updating");
    this.updateUrl(replace);
    if (!skipFetch) {
      this.collection.fetch({
        // instead of "data: this.data", a function is called
        data: this.filterUpdateData()
      });
    } else {
      this.renderData();
    }
    return this;
};

I then can "fix" the view's page data right before it's sent to this.collection.fetch(), with a separate function:

TableView.prototype.filterUpdateData= function() {
    var updateData = _.extend({}, this.data, {page:this.data.page - 1});
    return updateData;
};

This causes the data.page property to be decremented by 1, right before being submitted to this.collection.fetch().

Do you have any better ideas for how this could be implemented?

Remove dependence on Backbone.History

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));
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.