---
title: "grails + jquery grid plugin"
author: "dellsoft"
date: "2010-03-14T09:52:36Z"
tags: []
categories: ["企业架构"]
slug: "grails-jquery-grid-plugin"
draft: false
lastmod: "2010-03-14T09:53:13Z"
id: 615073
url: "https://dellsoft.iteye.com/blog/615073"
---

Jquery Grid Json 格式方法

http://trirand.com/blog/jqgrid/jqgrid.html

 

def listJson = {

    def nparams = \[:]

    if (params) {

      nparams\['sort'] = params.sidx

      nparams\['order'] = params.sord

 

    }

    def msztzd = Msztzd.list(nparams)

    def idCell = \[]

    def rowsR = msztzd.collect { dit -&gt;

      \[id: dit.fbh,cell:\[dit.fbh,dit.fmc,dit.fvision]]

    }

    response.setHeader("Cache-Control", "no-store")

    render(contentType:"text/json") {

      total ="1"

      page = "1"

      rows = array{

        for (zt in rowsR) {

           row id : zt.id ,cell : zt.cell

        }

      }

    }

  }