Ignore:
Timestamp:
Jun 30, 2011, 7:55:55 AM (13 years ago)
Author:
gav
Message:

Add filterpane search to InventoryStore? list view.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/InventoryStoreDetailedController.groovy

    r913 r957  
    33@Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_InventoryManager'])
    44class InventoryStoreDetailedController extends BaseController {
    5    
     5
     6    def filterService
     7
    68    @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_InventoryManager', 'ROLE_InventoryUser'])
    79    def index = { redirect(action:list,params:params) }
     
    1214    def list = {
    1315        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    14         [ inventoryStoreInstanceList: InventoryStore.list( params ), inventoryStoreInstanceTotal: InventoryStore.count() ]
     16        def associatedPropertyMax = 1000
     17        def associatedPropertyValues = [:]
     18        def siteNameQuery = 'select distinct a.name from Site a where a.isActive = ? order by a.name'
     19        associatedPropertyValues.siteList = Site.executeQuery(siteNameQuery, [true], [max:associatedPropertyMax])
     20
     21        if(!params.filter) {
     22            return [inventoryStoreInstanceList: InventoryStore.list(params),
     23                    inventoryStoreInstanceTotal: InventoryStore.count(),
     24                    associatedPropertyValues: associatedPropertyValues,
     25                    filterParams: params]
     26        }
     27
     28        // filterPane:
     29        return[ inventoryStoreInstanceList: filterService.filter( params, InventoryStore ),
     30                inventoryStoreInstanceTotal: filterService.count( params, InventoryStore ),
     31                associatedPropertyValues: associatedPropertyValues,
     32                filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params),
     33                params:params ]
    1534    }
    1635
     
    7392                def version = params.version.toLong()
    7493                if(inventoryStoreInstance.version > version) {
    75                    
     94
    7695                    inventoryStoreInstance.errors.rejectValue("version", "default.optimistic.locking.failure")
    7796                    render(view:'edit',model:[inventoryStoreInstance:inventoryStoreInstance])
Note: See TracChangeset for help on using the changeset viewer.