Created
June 21, 2011 22:23
-
-
Save 0xRoch/1039075 to your computer and use it in GitHub Desktop.
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
//form.html | |
#{list items:_fields ?: currentType.fields*.name, as:'fieldName'} | |
%{x++}% | |
<div id="${x}" style="height: 20px;"> | |
</div> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$('#${x}').load('@{CRUD.loadField(fieldName)}'); | |
}); | |
</script> | |
#{/list} | |
//crud.java | |
public static void loadField(String id, String field) { | |
ObjectType type = ObjectType.get(getControllerClass()); | |
notFoundIfNull(type); | |
Object object = SienaModelUtils.findById(type.entityClass, id); | |
Object field = object.getClass().getField(field).get(object); | |
render("CRUD/field.html", field); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment