Emberjs: sorting duplicates existing content - ember.js

Here is a jsfiddle for the question:
http://jsfiddle.net/stargazer/a46nj/
Clicking the insert button creates an object which has a name of 'Freyda', and inserts it into the App.Dummy. However you will see that after the sorting, the page just duplicates Tom(4). It seems it is only occuring on the level of the view part: if you examine your console, you will see that the content is sorted as intended.
There was a similar question with this: EmberJS sort Array Controller of Objects. Though the problem is not precisely same, one of the comments on that post said that related bug was corrected so trying latest version would solve the problem. However in my case latest version does not help.
I need it to sort the content automatically when a new object is pushed. Is there a better way or workaround for this problem?

Just remove App.Dummy.arrayDidChange, see http://jsfiddle.net/a46nj/3/

Related

Sitecore doesn't render any field types anymore

After a deploy to our Acceptance environment, templates in sitecore seem to be broken. We have installed them back with an item package from a working environment and did a revert on the /sitecore/templates/system tree.
We didn't notice any difficulties here, but when we try to edit with a rich text editor, we see the raw values. Even a tree list is rendered as a single line text field.
Next to that, the /sitecore/templates/system/templates/template item does not contain any fields.
Since we are on an acceptance environment, we cannot revert the entire database in case of data loss.
Do not think I entirely understand your issue, can you please be more specific and give us more details? You say templates are broken, but in what way exactly?Can you try reproducing that to ensure it happens again?
If you see everything as a text value, that happens because of you have Raw values in View tab switch on.

CollectionView not removing ItemView with TR

In my app, I've got a table of rows, each row containing data. When I click the "delete" button, I want it to remove the row.
The long and the short of it is that when I delete the object from the collection, the view disappears, the object disappears, but the template is left in the table.
If you move the collection view outside a table, replace all the tr's with divs, and all the td's with spans, this bug doesn't happen, and everything works smoothly.
http://emberjs.jsbin.com/EXEnUZE/4/edit
The above fiddle shows the problem. You should be able to edit the color, but if you delete one, the object itself is gone (as evidenced by the top list), and if you use the Chrome Ember Debugger on it, the view is gone, but the HTML for the row still remains.
Is this an Ember bug? Should I open an issue for it?
Admittedly I'm no pro when it comes to the collection view, but have you contemplated using an each instead? It seems to be a little less problematic.
http://emberjs.jsbin.com/EXEnUZE/9/edit
{{#each item in model}}
{{view App.PlayerView content=item}}
{{/each}}
Honestly it does seem a little buggy, the view itself did call destroy (I tried to manually call destroy on it), but it failed to remove itself from the page(maybe the collection as well, I didn't dig into it much). So you might submit a bug, or spend a little time digging into it, that's up to you. I'll keep digging into it as well and update this if I find anything.
As a extra answer, I filed a bug report on Ember for this, and got the following response: https://github.com/emberjs/ember.js/issues/3723
The suggestion of using tagName="table" on it, and then removing the tr's from inside the child views worked perfectly.

Ember.js having more than one view per controller/model

I have a controller and a model that get some data from the server.
I'm trying to initialize two views, one for editing and one for showing a list of items related to this data. For example, the model holds some search properties which the user may edit. After editing the search params I want to switch between the two views and display the refined search results.
I can't find any sample that does such switching.
I tried using Ember.ContainerView samples but all seems to be failing with nasty runtime errors.
Not sure that I have any relevant code sample :-(
Any help would be gladly appreciated
I've put together a demo that toggles editing, nothing special but it simulates your use case I guess, have a look here.
Hope it helps.

Can i build up some wiki/ google doc type editor by php???

it seems that the google doc/wiki is difficult if i code it from the zero
So, are there any kinds of api/plugin already have those code for php.
Also, how can wiki handle the parallel editing?? Say, one have update the content when the other one is updating. How can the latter one get the most updated information ????
Otherwise the updated content will be erase once the latter one submit update .
Thanks
I'm not sure about the first part of your question, but as for the parallel editing:
It seems to me that you're basically coding a CMS system. As with most CMSs (CMSii?), you're going to want every article to have two possible states: checked in or checked out. That way, you eliminate the possibility of 2 people working on the same article simultaneously.
So basically, in your database table that holds your article entries, you'd want a row called something like checked_out, which defaults to 0.
When an editor clicks to edit an article, your code first checks to make sure checked_out == 0. That way it knows you're the only one working on that particular article. Then, if it does allow you to work on the article, set checked_out to 1. When you click to save/update/whatever the article, make sure it sets checked_out back to 0.
Seems like the simplest solution to me.

Switching to a new workflow

We have a need to apply a new workflow to items in our content tree. This will replace the Workflow already in place.
I have a base item that these content items inherit from, so I can use that to change the default Workflow.
The problem is, how do I deal with items that are already in the various states of Workflow? Do I have to edit them individually to put them in the equivalent step of the new Workflow?
To answer your questions, yes. However, maybe consider switching them programatically rather than manually. Maybe you can run code to go through the items and switch WF states based on mappings from the old to new states. I recommend you post this question on the SDN forum or even ask Sitecore support as there may be consequences to doing this.