Ignore:
Timestamp:
Jun 29, 2011, 5:07:36 PM (13 years ago)
Author:
gav
Message:

Add filterpane search to Supplier list view.

File:
1 edited

Legend:

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

    r913 r955  
    33@Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_InventoryManager'])
    44class SupplierDetailedController extends BaseController {
    5    
     5
     6    def filterService
     7
    68    def index = { redirect(action:list,params:params) }
    79
     
    1113    def list = {
    1214        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    13         [ supplierInstanceList: Supplier.list( params ), supplierInstanceTotal: Supplier.count() ]
     15        def associatedPropertyMax = 1000
     16        def associatedPropertyValues = [:]
     17        def supplierTypeNameQuery = 'select distinct a.name from SupplierType a where a.isActive = ? order by a.name'
     18        associatedPropertyValues.supplierTypeList = SupplierType.executeQuery(supplierTypeNameQuery, [true], [max:associatedPropertyMax])
     19
     20        if(!params.filter) {
     21            return [supplierInstanceList: Supplier.list(params),
     22                    supplierInstanceTotal: Supplier.count(),
     23                    associatedPropertyValues: associatedPropertyValues,
     24                    filterParams: params]
     25        }
     26
     27        // filterPane:
     28        return[ supplierInstanceList: filterService.filter( params, Supplier ),
     29                supplierInstanceTotal: filterService.count( params, Supplier ),
     30                associatedPropertyValues: associatedPropertyValues,
     31                filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params),
     32                params:params ]
    1433    }
    1534
     
    7190                def version = params.version.toLong()
    7291                if(supplierInstance.version > version) {
    73                    
     92
    7493                    supplierInstance.errors.rejectValue("version", "default.optimistic.locking.failure")
    7594                    render(view:'edit',model:[supplierInstance:supplierInstance])
Note: See TracChangeset for help on using the changeset viewer.