I’m trying to create a basic grails domain object and for one of the fields I want to use an array of Strings. However even after running grails generate-views I still don’t see the ability to edit said array. Am I going about this wrong?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you run ‘grails install-templates’ you can edit src/templates/scaffolding/renderEditor.template which is where the HTML generation for editors is defined. Add in a new “else if” for String[]:
and implement renderStringArrayEditor however you think best:
I have no idea what HTML to use, but I might go with a textarea and split on \n. Whatever you decide on, you’ll need to convert the input parameter to a String array in your controller methods.
If you’re already run ‘grails generate-all’ or ‘grails generate-views’ you’ll need to run ‘grails generate-views’ to regenerate your GSPs with the new editor.