Monday, September 5, 2011

Announcement: Slickback v0.2.1

Version 0.2.1 of Slickback is now available. Slickback is a javascript library that makes it easier to use Backbone models and collections with the SlickGrid jQuery datagrid. New features in this version include support for displaying and editing Backbone model fields as text, integers, fixed precision numbers, and for selecting field values from dropdowns. Constructors for non-paginated Slickback collections are also new in this version. Slickback v0.2.1 is released under the MIT license and available on github or via npm.

3 comments:

  1. I am using SlickBack and i really like it!
    However i am not able to get it working when the element on which the slickgird is required is inside the Backbone View. It gives some error, since the element is still not present in the DOM.

    So, how to make the plugin work when the element is inside of a Backbone view?

    http://jsfiddle.net/YBfkK/3/

    ReplyDelete
    Replies
    1. Hi Gautam! I tried embedding the jsfiddle into a page and rendering myListView, which resulted in a "Cannot read property 'scrollWidth' of null". Is is the error that you are seeing?

      That error appears to be due to the fact that the SlickGrid constructor assumes that the initializing "container" element is a child of document.body: see the loop in bindAncestorScrollEvents(). To be clear, that's a limitation of SlickGrid, rather than anything SlickBack is doing.

      The loop in question could be fixed by patching SlickGrid so that the loop also exited if there were no more ancestors to bind events for. But it may be that there are other places where SlickGrid assumes that the elements it manages are present in the DOM.

      I hope this helps!

      Delete
  2. Thanks for the reply Riley! I had reached the same conclusion when i first debugged the problem and hence was looking for a solution. (Sorry i should have mentioned this in the first post)

    So to refine the problem statement: How to make the plugin work when the element is inside of a Backbone view ( and not yet present in the DOM)?

    Currently, i have put a dummy '#grid' at the bottom of body and when the grid is loaded i move it (`appendTo`) to a div of my Backbone view. This is a very hackish solution and i am looking for something clean.

    If you have an elegant solution to this problem please let me know.

    Thanks!

    ReplyDelete