Ignore:
Timestamp:
Oct 20, 2009, 5:55:50 PM (15 years ago)
Author:
gav
Message:

Add filterPane to Asset and Inventory search views.

Location:
trunk/grails-app/controllers
Files:
2 edited

Legend:

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

    r139 r156  
    22
    33class AssetDetailedController extends BaseController {
    4    
     4
     5    def filterService
     6
    57    def index = { redirect(action:search,params:params) }
    68
     
    1517    def search = {
    1618        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    17         [ assetInstanceList: Asset.list( params ), assetInstanceTotal: Asset.count() ]
     19
     20        // Quick Search:
     21        if(!params.filter) {
     22           return [ assetInstanceList: Asset.list( params ), assetInstanceTotal: Asset.count() ]
     23        }
     24        // filterPane:
     25        return[ assetInstanceList: filterService.filter( params, Asset ),
     26                assetInstanceTotal: filterService.count( params, Asset ),
     27                filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params),
     28                params:params ]
    1829    }
    1930
  • trunk/grails-app/controllers/InventoryItemDetailedController.groovy

    r139 r156  
    22
    33class InventoryItemDetailedController extends BaseController {
    4    
     4
     5    def filterService
     6
    57    def index = { redirect(action:search, params:params) }
    68
     
    1517    def search = {
    1618        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
    17         [ inventoryItemInstanceList: InventoryItem.list( params ), inventoryItemInstanceTotal: InventoryItem.count() ]
     19
     20        // Quick Search:
     21        if(!params.filter) {
     22            return[ inventoryItemInstanceList: InventoryItem.list( params ), inventoryItemInstanceTotal: InventoryItem.count() ]
     23        }
     24        // filterPane:
     25        return[ inventoryItemInstanceList: filterService.filter( params, InventoryItem ),
     26                inventoryItemInstanceTotal: filterService.count( params, InventoryItem ),
     27                filterParams: com.zeddware.grails.plugins.filterpane.FilterUtils.extractFilterParams(params),
     28                params:params ]
    1829    }
    1930
Note: See TracChangeset for help on using the changeset viewer.