grails + jquery grid plugin

hooopo 2010-03-14

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 ->

      [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

        }

      }

    }

  }

相关推荐