Reputation: 1316
Please give me real example of emberjs. This example will help me understand how to write in emberjs.
Description of example:
Please open this link first: http://jsfiddle.net/kwladyka/KhQvu/2/ (this is prototype to better understand what i am talking about)
And then read:
Emberjs download Groups.owner
by JSON from json.php?name=groups-owner&user_id=58
and Groups.member
from json.php?name=groups-member&user_id=58
. Both in Groups.all
.
In object Groups i have all values of arrays what i read from JSON. I want example read something like that: owner[2][name]
.
Then from CreateGroupsSelect
i want read Groups.all
and create ListBox with values group_id
and names name
. And when i change select i want change <p>You select {{name}} with id {{id}}</p>
and refresh data in other View emberjs objects.
I will be really gratefull for help. I am trying learn emberjs but i totally block with this example.
Ok, so i have many questions :)
1) How to bind value form input select to attribute in controller
var val = $('select option:selected').val();
Where can i find list of possible ussage like a "select option:selected". Any documentatin for that? Where?
2) "didInsertElement" How can i know i should use this? How should i looking in documentation to know that? Why not Ember.Select.Change for that?
3) Why author use "View", i thought for select i should use class "select"?
4) Seriously this is my first language when i fill all is so random and i dont have any idea how to know what i can write and where. I fill really stupid with that. Any hint how to understand that?
5) Ok so step by step...
First of all i want read JSON and prepare data to use.
Organizer.Groups = Ember.Object.extend({
owner: [],
member: [],
all: function(){
var owner = this.get('owner');
var member = this.get('member');
return owner.concat(member);
}.property('owner', 'member'),
});
a) "Object" is good choice for that?
b) I want fill "owner" by array from "json.php?name=groups-owner&user_id=58". How to do that? Did i define "owner" corretly or i should write "ArrayController" or something else for that? Mayby just "Array" or "ArrayProxy"? I am filling so confuse now.
c) How should i initiate load data from JSON? I want do this only one time on the beginning.
PS Sorry if you fill my questions are so stupid but i really dont know answers and i dont hide this :)
Upvotes: 0
Views: 7988
Reputation: 15566
Here is an example of how to work with select menu in Ember js
Here is an example of working with routes and outlet helper
Right way to do navigation with Ember
If you use routing make sure you have ember latest, routing is still not released.
Router / StateManager - can't make it work
When using latest emberjs refer to documentation in source code, the documentation in ember site will be for present stable release.
https://github.com/emberjs/ember.js
The links to routing is provided from your fidle title "Router with dynamic routes"
It will be hard to solve your complete problem, give it a try starting with the routing example from above, when you are stuck ask more specific questions, we'll be happy to help.
EDIT : Some of the links are already outdated.
Upvotes: 3