Ignore:
Timestamp:
Jul 1, 2011, 6:13:37 AM (13 years ago)
Author:
gav
Message:

Add filterpane search to InventoryLocation? list view.

File:
1 edited

Legend:

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

    r913 r958  
    33@Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_InventoryManager'])
    44class InventoryLocationDetailedController extends BaseController {
     5
     6    def filterService
    57
    68    // the delete, save and update actions only accept POST requests
     
    1315    def list = {
    1416        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    15         [ inventoryLocationInstanceList: InventoryLocation.list( params ), inventoryLocationInstanceTotal: InventoryLocation.count() ]
     17        def associatedPropertyMax = 1000
     18        def associatedPropertyValues = [:]
     19        def inventoryStoreNameQuery = 'select distinct a.name from InventoryStore a where a.isActive = ? order by a.name'
     20        associatedPropertyValues.inventoryStoreList = InventoryStore.executeQuery(inventoryStoreNameQuery, [true], [max:associatedPropertyMax])
     21
     22        if(!params.filter) {
     23            return [inventoryLocationInstanceList: InventoryLocation.list(params),
     24                    inventoryLocationInstanceTotal: InventoryLocation.count(),
     25                    associatedPropertyValues: associatedPropertyValues,
     26                    filterParams: params]
     27        }
     28
     29        // filterPane:
     30        return[ inventoryLocationInstanceList: filterService.filter( params, InventoryLocation ),
     31                inventoryLocationInstanceTotal: filterService.count( params, InventoryLocation ),
     32                associatedPropertyValues: associatedPropertyValues,
     33                filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params),
     34                params:params ]
    1635    }
    1736
     
    7493                def version = params.version.toLong()
    7594                if(inventoryLocationInstance.version > version) {
    76                    
     95
    7796                    inventoryLocationInstance.errors.rejectValue("version", "default.optimistic.locking.failure")
    7897                    render(view:'edit',model:[inventoryLocationInstance:inventoryLocationInstance])
Note: See TracChangeset for help on using the changeset viewer.