I have a table with a series of events. The name of my class is a record.
Here is an image of my table
is in Spanish, but the basics are the same, so this should not be a problem. (The filter's HTML code is still not that mess, but it works)
and here are the results that I get when I search for a record.
http://i45.tinypic.com/r1iexv.jpg
Now my problem is that I need results that should be shown / filtered into the same table from pic1, so this will be basically like updating a table that applies filters.
If you need more information, here is a link to my old question. Thanks proflux!
I have a bunch of data and I need a data filter using Grails
Most of the search code is there,
Any help would be greatly appreciated!
UPDATE:
I have a problem with filtering dates, though ... I have two dates ... One of them is the date when the event will happen, and the other is the last one that I think is the keyword for grails the last time you changed the event . Any help related to filter dates would be greatly appreciated.
I need to show everything on the first table, starting today. And if I want to find something from the past, I have to use a filter to find it.
Any ideas on how to do this?
UPDATE:
So here is my list .gsp
http://i49.tinypic.com/291ksy1.png
and here is my search for Results.gsp with filters applied to the word "Ruta"
So basically everything looks pretty and pretty, but date filters don't work.
Here is the code in the controller that does not filter dates
def searchResults = {
def entryCriteria = Entry.createCriteria()
def results = entryCriteria.list {
if(params?.proyectoRuta) {
ilike("proyectoRuta","%${params.proyectoRuta}%")
}
}
if(params?.day) {
eq("fechaCambio", params.day)
}
render(view:'searchResults', model:['results':results])
}
filters the word but not the date
proyectoRuta , fechaCambio - , . .
UPDATE:
, : , defs
def search = {
render(view:'search')
}
def searchResults = {
def entryCriteria = Entry.createCriteria()
def results = entryCriteria.list {
if(params?.fechaCambioD && params?.fechaCambioH) {
between("fechaCambio", params.fechaCambioD, params.fechaCambioH)
}
if(params?.lastUpdatedD && params?.lastUpdatedH) {
between("lastUpdated", params.lastUpdatedD, params.lastUpdatedH)
}
if(params?.proyectoRutaN) {
ilike("proyectoRuta","%${params.proyectoRutaN}%")
}
}
render(view:'searchResults', model:['results':results, 'proyectoRutaN':params?.proyectoRutaN, 'fechaCambioD':params?.fechaCambioD, 'fechaCambioH':params?.fechaCambioH, 'lastUpdatedD':params?.lastUpdatedD, 'lastUpdatedH':params?.lastUpdatedH])
}
}
searchResults.gsp
<tbody>
<g:each in="${results}">
<td><g:formatDate format="dd-MMMM-yyyy" date="${it.fechaCambio}" /></td>
<td><b>${it.proyectoRuta}</b></td>
<td>${it.summary}</td>
<td><g:formatDate format="dd-MMM-yyyy HH:mm z" date="${it.lastUpdated}" /></td>
<td>
<g:form>
<g:hiddenField name="id" value="${it?.id}" />
<span class="simple"><g:actionSubmit class="editar" action="edit" value="${message(code: 'default.button.editar.label', default: ' ')}" /></span>
<span class="simple"><g:actionSubmit class="eliminar" action="delete" value="${message(code: 'default.button.eliminar.label', default: ' ')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Esta seguro que desea Eliminar?')}');" /></span>
</g:form>
</td>
</tr>
</g:each>
</tbody>