Created
April 28, 2011 18:33
-
-
Save demogar/946960 to your computer and use it in GitHub Desktop.
chain js javascript
This file contains hidden or 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
| $(document).ready(function() { | |
| var array = [ | |
| {first:'Isaac', last:'Newton', id: '1'}, | |
| {first:'Johannes', last:'Keppler', id:'2'}, | |
| {first:'Alessandro', last:'Volta', id: '3'}, | |
| {first:'Blaise', last:'Pascal', id: '4'} | |
| ]; | |
| $('#persons') | |
| .items(array) | |
| .chain({ | |
| self: { | |
| value: '{id}', | |
| content: '{first} {last}' | |
| } | |
| }); | |
| $("#some_name").click(function() { | |
| actualizar(); | |
| }); | |
| }); | |
| function actualizar() | |
| { | |
| var resultado = [ | |
| {first:'Isaac', last:'Newton', id: '1'}, | |
| {first:'Johannes', last:'Keppler', id:'2'} | |
| ]; | |
| $('#persons') | |
| .items("replace", resultado); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment