Created
January 11, 2012 13:48
-
-
Save joachimhs/1594730 to your computer and use it in GitHub Desktop.
bidning problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For some reason I am unable to get the bindings to work as they are supposed to... | |
index.html: | |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>index</title> | |
<link rel="stylesheet" href="css/master.css" type="text/css" charset="utf-8"> | |
<meta name="generator" content="TextMate http://macromates.com/"> | |
<meta name="author" content="Joachim Haagen Skeie"> | |
<script src="scripts/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script> | |
<script src="scripts/ember-0.9.3.js" type="text/javascript" charset="utf-8"></script> | |
<script src="app/main.js" type="text/javascript" charset="utf-8"></script> | |
</head> | |
<body bgcolor="#555154"> | |
<script type="text/x-handlebars" > | |
{{#with KR.RegistrereSakController.content}} | |
<table> | |
{{#each felter}} | |
<tr> | |
<td>{{feltNavn}}: </td> | |
<td>{{view Ember.TextField valueBinding="feltVerdi"}}</td> | |
<td>{{feltType}}</td> | |
</tr> | |
{{/each}} | |
</table> | |
<hr> | |
{{#each felter}} | |
{{feltNavn}}: {{feltVerdi}} | |
{{/each}} | |
{{/with}} | |
</script> | |
</body> | |
</html> | |
---- main.js: | |
KR = Ember.Application.create({ | |
ready: function() { | |
console.log('Appication ready'); | |
//$.tablesorter.defaults.widgets = ['zebra']; | |
//KR.stateManager = KR.stateManagerObj.create(); | |
} | |
}); | |
KR.HtmlFeltType = Em.Object.extend({ | |
feltNavn: '', | |
feltType: '', | |
feltVerdi: '' | |
}); | |
KR.HtmlSkjema = Em.Object.extend({ | |
felter: [] | |
}); | |
KR.RegistrereSakController = Em.Object.create({ | |
content: KR.HtmlSkjema.create({felter: []}), | |
init: function() { | |
console.log('Em.RegistrereSakController init. Pusher felter'); | |
this.get('content').get('felter').pushObject(KR.HtmlFeltType.create({feltNavn: 'Saksnummer', feltVerdi: 'abc', feltType: 'input'})); | |
this.get('content').get('felter').pushObject(KR.HtmlFeltType.create({feltNavn: 'Innmelder', feltVerdi: 'def', feltType: 'input'})); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment