Reputation: 13811
I have a domain class named DaySchedule
like this:
class DaySchedule {
Date Todaysdate
String startTime;
String endTime;
String task
int priority
boolean completed
}
I have defined a controller for this domain class :
def allcompletedtask = {
def completedtask = new DaySchedule(completed:true)
def completedwork = DaySchedule.findAll(completedtask)
[ completedwork : completedwork ]
}
(To find the list of completed task)
For rendering it, I have a view file like this :
<html>
<head>
<title>
Completed Task.
</title>
<meta name ="layout" content="main" />
</head>
<body>
<h2> All these are the completed task </h2>
<g:each in="${completedwork}" var="completedtask">
<div id = "todayswork" >
${completedtask.task} completed by
${completedtask.schedule.user.login}
</div>
</g:each>
</body>
</html>
I have some table inserted via BootStrap
file. In which I have defined some as completed
and some as not completed
via setting true
and false
respectively.
But the problem is, while rendering(that is when viewing in browser), I'm getting the output only as this :
And the output screen suggests that these lines from the view file have not rendered :
<div id = "todayswork" >
${completedtask.task} completed by
${completedtask.schedule.user.login}
</div>
No errors have shown, where I went wrong? Whats happening behind the scenes?
I found out the problem is with boolean
type in Domain class DaySchedule
. If I change that to String
and use "yes"
in place of true
. I get what I need. But why boolean
is not working properly?
Thanks in advance.
Upvotes: 0
Views: 172
Reputation: 3124
Keep your completed as boolean - having it as a String with 'yes'/'no' is just plain clutter.
Try change your actionh to:
def allcompletedtask = {
def completedwork = DaySchedule.findAllByCompleted(true)
println completedwork // Just to check if your model is correct
[ completedwork : completedwork ]
}
I see no reason why you would use query by example
Upvotes: 2