Backbone model attributes are nested twice after upgrading to backbone 1.3.3 - backbone.js

After upgrading my project to backbone 1.3.3 my attributes are nested inside another attributes parameter.
What I mean is that they appear in this.model.attributes.attributes rather than in this.model.attributes.
This seems to happen in instances of Marionette.CollectionView as well as Backgrid.Cell but not in other View instances. I put some debug statements inside the Backgrid Cell code and it seems that the model comes with this issue even when initializing it.
It doesn't seem that I am changing the model anywhere in my code after the upgrade nor did I before, is this a change inherent to backbone or backgrid?

Turns out that directly upgrading backbone was not the issue but instead the dependency to backbone-pageable. backbone-pageable has been deprecated and replaced for backbone.paginator which was the one causing the issue as my model was formatted differently. Parsing and reformatting the result of my pageable collection was the solution. Alternatively downgrading to backbone-pageable also solves the problem.

Related

Angular 2 migration questions

I'd like to prepare our codebase for Angular 2 migration as much as possible. I understand that there isn't a solid migration strategy yet but still, there are two issues that I'm concerned about:
Not using watches anymore.
Not using two-way bindings anymore.
Let's say I have a directive that I want to keep updated according to model changes. How can I implement it without watches?
What if this directive is an interactive element and I want the model to reflect its changes? How can I do that without two-way bindings?
(If you have any other such problematic scenarios on mind please let's raise them and let's try to find solutions.)
Since there isn't any pre-alpha version released yet we can only guess on how migrating could work. I found this article which helped me to understand the new concept a little better.

How to use ng-grid in Hawtio?

I believe that ng-grid requires at least AngularJS 1.2.x.
I noticed that there is an ng-grid module in Hawtio. Is it possible to use this ng-grid module in Hawtio's current AngularJS version 1.1.5?
Can someone give an example how to use this? We tried but were getting errors, maybe due to version dependency.
Yeah you can use that, though we used ng-grid in the start with hawtio, but it has some issues (not all data was shown in all browsers etc) and was slow. And we needed a simple grid, so we wrote a simpletable we used instead.
But you should be able to use it,maybe search the source code of hawtio-web and find the few spots left where ng-grid may still be in use.

Angular ui.grid paging vs. pagination

I am new to ui.grid and using the tutorial to get a grid with lots of data.
My version is 3.0.0.RC16 which I got from bower install angular-ui-grid
I would like to use paging but get errors.
There are 2 Tutorials regarding paging one called Pagination and one Paging:
http://ui-grid.info/docs/#/tutorial/214_pagination
http://ui-grid.info/docs/#/tutorial/215_paging
Whats the difference between the two?
Module 'ui.grid.paging' does not exist while 'ui.grid.pagination' does. What am I missing?
I want to use the paging example but always get errors
Do I need a special unstable release? how to install it with bower?
Thanks!
UPDATE
Meanwhile I manually downloaded the unstable version of ui-grid and indeed, paging exists only in unstable. I could not find explanations on the web why this is the case, so I assume that its not ready for prod. Nevertheless I would like to understand the difference to Pagination and if there is a bower package to install unstable versions.
UPDATE
meanwhile Paging was removed from the unstable versions. It seems the functionality was completely merged into pagination.
I had to change "paging" into "pagination" in controllers and views and everything seems to work (so far)
https://github.com/angular-ui/ng-grid/pull/2399
I was not the only one confused
I'm not using bower so I cannot help you with this one.
But I can tell you a few words to the difference of 'paging' and 'pagination' in ui-grid:
As far as I know the 'pagination'-module was a first and new development of paging in ui-grid. A few weeks later, someone tried to reimplement the paging from the old grid-version nggrid in the new ui-grid and named it 'paging'.
There are efforts to combine the two. See this issue on github:
http://github.com/angular-ui/ng-grid/issues/2106
Facing rapid changes in ui-grid, github seems to be the best place to get answers to problems with ui-grid. The tutorial is most of the time not up to date.
But the active developers react very fast on incoming issues on github.

Can i use Angular UI Router in my project?

we are starting new project which uses angularjs as UI script.
I've gone through angular ui-router for https://github.com/angular-ui/ui-router.
UI-router module really great when compare to ngroute.
But I am afraid about the warning mentioned the ui-router's website homepage.
(Note: UI-Router is under active development. As such, while this library is well-tested, the API may change. Consider using it in production applications only if you're comfortable following a changelog and updating your usage accordingly.)
But i want to use this framework with angular.
Can anyone please suggest, will this cause any performance issue in future, much api will change, etc.
if the current version of angular-ui/ui-router works fine for you that is all you need.
will this cause any performance issue in future
why should it? since you are going to save your copy of the current version of angular-ui and it runs on client side you will never have problems (if you update angular-ui in 5 years of course you are going to have problems, if you never update it will ALWAYS work)
the note you quoted means that the current support of that library might change, so all you have to do(if they don't provide support for older versions) is to save a copy of those docs.

Converting Regular Backbone App to use Marionette.js

I am considering changing our current application to use Marionette. The trouble is that there is currently a whole number of different views, models, and collections that have been made by other developers that use regular Backbone.
I figure I can't really convert the whole application in one go especially considering I didn't develop a whole bunch of it. I am considering just starting with the Application object and Router.
Is this going to be possible? Can I start with that and convert the actual views later?
We recently converted our backbone application to use marionette, and we started with creating a new marionette application and router, and then created a few regions and layouts which managed our older Backbone views.
We were then able to convert the old backbone views to Marionette's ItemViews and CompositeViews, and we found we were able to delete a lot of old code.
Any custom collections and models we kept untouched. You'll probably find you won't need to change them.
My advice is to have a good read through the docs and have a look through how other people have their application structured, and how their router works. There are a few boilerplate examples and generators on github.
The simple answer is yes, you can convert the app piece by piece over time.
And your strategy of starting with the Application and Router is good. I've done a few projects where I only used the Application, Router, and maybe the Module feature of Marionette, keeping the rest plain Backbone.
From the Marionette Docs:
Like Backbone itself, you're not required to use all of Marionette
just because you want to use some of it. You can pick and choose which
features you want to use. This allows you to work with other Backbone
frameworks and plugins easily. It also means that you are not required
to engage in an all-or-nothing migration to begin using Marionette.
And even once you start converting the views, you can do it one view at a time, as needed.

Resources