读书人

Sigma-grid分页的后盾方法

发布时间: 2012-11-03 10:57:43 作者: rapoo

Sigma-grid分页的后台方法

?

1.客户端sigma-grid的loadURL:../../service?action=BaseQuery因为是示例,所以在SQL语句直接写在sigma-grid的gridOption中:

//这里的ds是写的一个二维的结果,类似于数据库表的数据结构     ds = db.QuerySQL(sqlstr);     for (int row = 0;row < ds.getRowCount() ;row++){          HashMap record = new HashMap();     for (int col = 0;col < ds.getColumnCount(); col++){     record.put(ds.getColumnName(col), ds.getStringAt(row,col));     }     data.add(record);     }         Map pageInfo = new HashMap();     pageInfo.put("pageSize", pageSize);     pageInfo.put("pageNum", pageNum);     pageInfo.put("totalRowNum", totalRowNum);     pageInfo.put("startRowNum", startRowNum);     pageInfo.put("endRowNum", endRowNum);          Map gtJsonOut=new HashMap();            gtJsonOut.put("pageInfo",pageInfo);            gtJsonOut.put("data",data );                   ret =  this.getJsonString4Map(gtJsonOut);        db.Commit();    }catch(Exception e){    db.Close();    e.printStackTrace();    }finally{    if ( db != null ){    db.Close();    }        }    return ret;    }

?

?

?

?

?

?

?

?

?

?

?

?

读书人网 >Web前端

热点推荐